Sign in to follow this  

number suffixes

This topic is 4529 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
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
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

This topic is 4529 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this