[Info-vax] C compiler question

John Reagan xyzzy1959 at gmail.com
Sat Jul 27 13:19:12 EDT 2019


On Saturday, July 27, 2019 at 12:57:32 PM UTC-4, Mark Berryman wrote:
> Something I see all the time when porting unix code is something similar 
> to the following:
> 
> unsigned int x;
> .
> .
> .
> if (x <= 0) {something}
> 
> This, of course, generates a QUESTCOMPARE informational.  I'm wondering 
> what code the compiler generates in such a case.  Does it treat the 
> variable as if it had been declared signed or does it do something else? 
>   Is the compiler's behavior in this case defined by a standard or is it 
> left up to the implementation?
> 
> Part of what I am wondering is if I can count on the code generated by a 
> VMS compiler to function the same as the code generated by a gcc or 
> clang compiler.
> 
> Thanks,
> Mark Berryman

it turns into "if (x == 0) {something}".  That would be per the standard.



More information about the Info-vax mailing list