# number suffixes

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

## 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 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 on other sites
Quote:
 Original post by moerondouble 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 on other sites
L applied to a floating-point number resolves the type as long double, not double or long.

Enigma

##### Share on other sites
Yeah, I just looked it up. Sorry about that.

##### 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 on other sites
MSVC supports i64 as well. e.g. __int64 x = 0i64;. Actually it seems to except iX where X is 8,16,32,64.

##### 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).

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 12
• 13
• 10
• 11
• 13
• ### Forum Statistics

• Total Topics
634096
• Total Posts
3015482
×