3 ms·
>But, that's not required behaviour by the standard, I could make nullptr internally be any mess of values I like. But compiler writers usually aren't trying t
by palunon 10y ago
>But, that's not required behaviour by the standard, I could make nullptr internally be any mess of values I like.
But compiler writers usually aren't trying to go out of their way to trip you up.
Can you provide an example of a compiler where nullptr doesn't have a 0 bit pattern ?
- CJefferson 10y agoNo, but once you start invoking undefined behaviour, all bets are off. For example, there are compilers that print nothing for the following function, with uninitialised 'i', whereas some programmers assume that i must take "some value", so one of A and B will be printed. int func() { int i; if(i > 0) printf("A"); if(i <= 0) printf("B"); }