CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

LESS than <0

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
scanan



Joined: 13 Aug 2004
Posts: 58
Location: Turkey

View user's profile Send private message Visit poster's website

LESS than <0
PostPosted: Wed Sep 01, 2004 5:05 am     Reply with quote

why
if(x<0) don't work
alexbilo



Joined: 01 Jun 2004
Posts: 39
Location: Trois-Rivières

View user's profile Send private message

PostPosted: Wed Sep 01, 2004 5:47 am     Reply with quote

Quote:

why
if(x<0) don't work


Actually, it does... I think that posting a little more details about your code would help...

What make you think that it doesn't work?
_________________
Alex
Ttelmah
Guest







Re: LESS than <0
PostPosted: Wed Sep 01, 2004 6:38 am     Reply with quote

scanan wrote:
why
if(x<0) don't work

It won't work, if 'x' is an _unsigned_ integer. Remember the default 'int' type is unsigned...

Best Wishes
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Wed Sep 01, 2004 8:25 am     Reply with quote

Try:

signed int8 x;

that should make 'x' be valid from -128 to 128. If you omit the 'signed' portion it makes 'x' valid from 0 to 255. That one bit me when I first started using CCS.

Ronald
bdavis



Joined: 31 May 2004
Posts: 86
Location: Colorado Springs, CO

View user's profile Send private message

PostPosted: Wed Sep 01, 2004 10:31 pm     Reply with quote

How about -127 to 128 instead of -128 to 128? I'm sure that's what you probably meant anyway Very Happy
Guest








PostPosted: Thu Sep 02, 2004 2:25 am     Reply with quote

And how about -128 to 127? 0b01111111 is 127.I'm sure that's what you probably meant anyway Smile
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Thu Sep 02, 2004 8:33 am     Reply with quote

Ok, Ok. Got some smart ones out there.

I guess I'll just walk over to the bit bucket and toss one in the garbage to make it and even -127. Shocked
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group