Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   the modulus operator in Windriver C++ (http://www.chiefdelphi.com/forums/showthread.php?t=90763)

Ether 02-02-2011 12:54

the modulus operator in Windriver C++
 



Would someone with ready access to Windriver C++ please run the following short program and post whether it returns "-179" or "+181" ?

Code:

void main (void) {
signed int err;
err=(-179)%360;
printf("err=%d",err);
}

The old C compiler I have here returns -179, but I am told that newer compilers return +181.

Thanks.



Ether 10-02-2011 15:53

Re: the modulus operator in Windriver C++
 
4 Attachment(s)
Page 82 of ISO/IEC 9899:TC3 (attached) shows that

(-179)%360 must be -179




All times are GMT -5. The time now is 17:48.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi