Valid type indentifiers and their combinations

I hope I got that title right. I'm new to C++ and I've started reading the tutorials for a few weeks. I'm using MSVS2010 Ultimate and I was wondering how do you know what combinations of type identifiers (is that how I say it?) are valid? Also how do you determine how one affects another (their size in bytes) i.e a regular int is 4 bytes long but a short int is 2 bytes.

Why doesn't a short short int exist? I asked over at stackoverflow but they were a bit harsh on me and vaguely said that.

When I output the size of a long double its the same as the size of a double on my machine. Does that mean that a long double for me is in effect the same as a double? Or does that change on different platforms.

Thanks
Nubcake
Last edited on
I would say a short short int would be nothing more than a char (1 byte). I don't know much about the whole long double thing though
No, a short(2 bytes)+short(2 bytes) int=an int(4 bytes) so there is no need for that to exist.

When I output the size of a long double its the same as the size of a double on my machine. Does that mean that a long double for me is in effect the same as a double? Or does that change on different platforms.

Generally, a long double=double as long int=int. But a long long double is different.
Also, the size(bytes) of these data types vary accross different platforms, but types like bool(boolean) are constant.

NB: these are not called identifiers, but ragher, data types. The names given to variables, function,etc...are rather the IDs.

Aceix.
Last edited on
Even if the size of two types is the same doesn't mean they are the same type.

1
2
3
4
5
typedef long      T1;
typedef long long T2;
std::cout << std::boolalpha;
std::cout << (sizeof(T1) == sizeof(T2)) << std::endl;
std::cout << std::is_same<T1, T2>::value << std::endl;
true
false
Topic archived. No new replies allowed.