# number suffixes

## Recommended Posts

moeron    326
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
doynax    850
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
microdot    324
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
Enigma    1410
L applied to a floating-point number resolves the type as long double, not double or long.

Enigma

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

##### Share on other sites
moeron    326
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
Anon Mike    1098
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
Nemesis2k2    1045
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).