Home » Community » U++ community news and announcements » 2024rc1
Re: 2024rc1 [message #61034 is a reply to message #61033] |
Mon, 21 October 2024 12:55   |
Lance
Messages: 656 Registered: March 2007
|
Contributor |
|
|
mirek wrote on Mon, 21 October 2024 03:05
How? I have noticed that some people tend to constexpr to everything, but I fail to see a reason. If that is supposed to perform the test only in compile time, then 30 years old compiler will do that anyway. But I might be missing something perhaps?
On a second thought, you are right. A reasonably good compiler would perform the optimization anyways. I remeber a couple years ago when I dig into u++ memory allocation utilities, I saw this one
template <class T>
void memcpy_t(void *t, const T *s, size_t count)
{
if((sizeof(T) & 15) == 0)
memcpy128(t, s, count * (sizeof(T) >> 4));
else
if((sizeof(T) & 7) == 0)
memcpy64(t, s, count * (sizeof(T) >> 3));
else
if((sizeof(T) & 3) == 0)
memcpy32(t, s, count * (sizeof(T) >> 2));
else
if((sizeof(T) & 1) == 0)
memcpy16(t, s, count * (sizeof(T) >> 1));
else
memcpy8(t, s, count * sizeof(T));
}
Now I know you already counted on the compile time optimization.
Then the question becomes: what constexpr-if has to offer? Maybe speak a programmer's intention more explicitly and thus possible compiler check, like override?
|
|
|
 |
|
2024rc1
By: mirek on Sat, 28 September 2024 09:16
|
 |
|
Re: 2024rc1
By: Tom1 on Sat, 28 September 2024 18:36
|
 |
|
Re: 2024rc1
By: JeyCi on Sat, 28 September 2024 19:21
|
 |
|
Re: 2024rc1
By: mirek on Sun, 29 September 2024 20:51
|
 |
|
Re: 2024rc1
By: Didier on Sat, 28 September 2024 20:50
|
 |
|
Re: 2024rc1
By: Tom1 on Sat, 28 September 2024 22:55
|
 |
|
Re: 2024rc1
By: mirek on Sun, 29 September 2024 20:55
|
 |
|
Re: 2024rc1
By: Tom1 on Sun, 29 September 2024 22:02
|
 |
|
Re: 2024rc1
By: mirek on Sun, 29 September 2024 23:14
|
 |
|
Re: 2024rc1
By: Lance on Mon, 30 September 2024 01:02
|
 |
|
Re: 2024rc1
By: mirek on Mon, 30 September 2024 12:01
|
 |
|
Re: 2024rc1
By: Tom1 on Mon, 30 September 2024 12:06
|
 |
|
Re: 2024rc1
By: Tom1 on Mon, 30 September 2024 15:37
|
 |
|
Re: 2024rc1
By: Lance on Sat, 12 October 2024 17:31
|
 |
|
Re: 2024rc1
By: Lance on Sat, 12 October 2024 20:20
|
 |
|
Re: 2024rc1
By: Lance on Sun, 13 October 2024 06:10
|
 |
|
Re: 2024rc1
By: mirek on Sun, 13 October 2024 07:52
|
 |
|
Re: 2024rc1
By: Lance on Sun, 13 October 2024 13:28
|
 |
|
Re: 2024rc1
By: mirek on Sun, 13 October 2024 13:55
|
 |
|
Re: 2024rc1
By: Lance on Sun, 13 October 2024 14:20
|
 |
|
Re: 2024rc1
By: mirek on Sun, 13 October 2024 13:58
|
 |
 |
Re: 2024rc1
By: Lance on Sun, 13 October 2024 14:23
|
 |
|
Re: 2024rc1
By: mirek on Mon, 14 October 2024 16:17
|
 |
|
Re: 2024rc1
By: Lance on Mon, 14 October 2024 17:09
|
 |
|
Re: 2024rc1
By: mirek on Tue, 15 October 2024 07:40
|
 |
|
Re: 2024rc1
By: mirek on Mon, 14 October 2024 16:13
|
 |
|
Re: 2024rc1
By: Lance on Mon, 14 October 2024 16:23
|
 |
|
Re: 2024rc1
By: mirek on Mon, 14 October 2024 16:42
|
 |
|
Re: 2024rc1
By: Lance on Mon, 14 October 2024 17:21
|
 |
|
Re: 2024rc1
By: mirek on Tue, 15 October 2024 13:31
|
 |
|
Re: 2024rc1
By: Lance on Tue, 15 October 2024 15:18
|
 |
|
Re: 2024rc1
By: mirek on Thu, 17 October 2024 10:47
|
 |
|
Re: 2024rc1
By: Lance on Thu, 17 October 2024 21:01
|
 |
|
Re: 2024rc1
By: Lance on Mon, 21 October 2024 02:11
|
 |
|
Re: 2024rc1
By: Lance on Mon, 21 October 2024 02:27
|
 |
|
Re: 2024rc1
By: mirek on Mon, 21 October 2024 09:05
|
 |
|
Re: 2024rc1
By: Lance on Mon, 21 October 2024 12:55
|
 |
|
Re: 2024rc1
By: Lance on Mon, 21 October 2024 13:01
|
 |
|
Re: 2024rc1
By: mirek on Mon, 21 October 2024 13:21
|
 |
|
Re: 2024rc1
By: mirek on Mon, 21 October 2024 14:45
|
 |
|
Re: 2024rc1
By: Lance on Mon, 21 October 2024 18:12
|
 |
|
Re: 2024rc1
By: Lance on Wed, 16 October 2024 00:11
|
 |
|
Re: 2024rc1
By: mirek on Wed, 16 October 2024 11:30
|
 |
 |
Re: 2024rc1
By: Lance on Wed, 16 October 2024 15:18
|
 |
|
Re: 2024rc1
By: Oblivion on Sun, 13 October 2024 09:53
|
 |
|
Re: 2024rc1
By: mirek on Mon, 14 October 2024 15:36
|
Goto Forum:
Current Time: Sun Jun 08 17:43:10 CEST 2025
Total time taken to generate the page: 0.07695 seconds
|