Go to Post Minnesota could pioneer the idea of suspending a field 20 feet above the other field and have true double decker events. - PayneTrain [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 02-02-2011, 12:54
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,015
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
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.


Reply With Quote
  #2   Spotlight this post!  
Unread 10-02-2011, 15:53
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,015
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: the modulus operator in Windriver C++

Page 82 of ISO/IEC 9899:TC3 (attached) shows that

(-179)%360 must be -179


Attached Files
File Type: pdf scope.pdf (19.4 KB, 0 views)
File Type: txt Delphi4.txt (538 Bytes, 2 views)
File Type: pdf 82.pdf (27.5 KB, 0 views)
File Type: txt Borland C++ 551.txt (528 Bytes, 0 views)

Last edited by Ether : 10-02-2011 at 15:55.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 02:37.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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