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

Stupid question :lol:

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



Joined: 23 Sep 2009
Posts: 55
Location: Ukraine

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

Stupid question :lol:
PostPosted: Thu Apr 14, 2011 8:15 am     Reply with quote

Several times in the listings I saw a record number: 5000000L What does the letter L after the number 5000000?

Code:

frequency =  (5000000L / (float)current_ccp_delta);


I reread the instruction to the compiler and have not found an answer to this simple question.
newguy



Joined: 24 Jun 2004
Posts: 1903

View user's profile Send private message

PostPosted: Thu Apr 14, 2011 8:44 am     Reply with quote

Long. It forces the compiler to use 16 or 32 bit manipulations. ....Kind of like a forced cast I suppose.
Eddy71ua



Joined: 23 Sep 2009
Posts: 55
Location: Ukraine

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

PostPosted: Thu Apr 14, 2011 12:43 pm     Reply with quote

Of course is long. 5000000 does not fit in int16. Why is it tells the compiler?
Ttelmah



Joined: 11 Mar 2010
Posts: 19369

View user's profile Send private message

PostPosted: Thu Apr 14, 2011 3:00 pm     Reply with quote

Probably 'left in'.
Key is that if the same function is used with different numbers - perhaps 'defines', and the numbers drop below first 65536, and then below 256, the compiler will switch to using first 16bit, and then 8bit arithmetic. Using 'L' prevents this. It is part of standard C, and 'belt and braces', quite good practice if you want to be absolutely _sure_ that a drop back won't happen.

Best Wishes
Eddy71ua



Joined: 23 Sep 2009
Posts: 55
Location: Ukraine

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

PostPosted: Thu Apr 14, 2011 3:02 pm     Reply with quote

Thank you very much for the detailed response Rolling Eyes
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