Jump to content
  • Advertisement
Sign in to follow this  
moeron

number suffixes

This topic is 4811 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Not that it really matters, but I was just curious if there is a suffix to show that you are using a short integer. For example..
unsigned long myul = 0UL;
unsigned int myuint = 0U;
float myfloat = 3.0F;
double myDouble = 0.0L;
Are there any other suffixes out there?

Share this post


Link to post
Share on other sites
Advertisement
C99 has LL and ULL for long longs but other than those I think you've got them all.
The strange thing about them and hexadecimal constants (including it's prefix) is that they're case insensitive.

Share this post


Link to post
Share on other sites
Quote:
Original post by moeron
double myDouble = 0.0L;

I'm fairly certain that L is long, not double. Double literals are the same as float literals sans the f.

Share this post


Link to post
Share on other sites
L applied to a floating-point number resolves the type as long double, not double or long.

Enigma

Share this post


Link to post
Share on other sites
yea I wasn't too sure about whether a double should have an L or not. Thanks for clearing that one up for me. long double == double on my system anyway, but on others it might not, so I'm glad I got that straightened out

Share this post


Link to post
Share on other sites
Quote:
Not that it really matters, but I was just curious if there is a suffix to show that you are using a short integer.

The C++ standard doesn't define one, so none that you should use. Normal integer literals with no prefix or suffix will only be assigned a type of int or long int, and suffixes only exist to specify a literal is either long or unsigned (l or L, and u or U respectively).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!