Fantastic exchange from DConf

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Sun May 14 13:10:24 PDT 2017


On Sunday, 14 May 2017 at 19:10:05 UTC, Ola Fosheim Grøstad wrote:
> On Sunday, 14 May 2017 at 16:44:10 UTC, Patrick Schluter wrote:
>> What does that snippet do ? What should it do?
>>
>> int caca(void)
>> {
>>   for(int i=0xFFFFFFFF; i!=0x80000000; i++)
>>     printf("coucou");
>> }
>
> Implicit coercion is a design bug in both C and D... :-P

Of course the annoying part is that C allows 2s-complement 
notation for integer literals, so with warnings on:

int i = 0xFFFFFFFF; // passes without warning.
int i = 0xFFFFFFFFUL; // warning is issued.



More information about the Digitalmars-d mailing list