Is the construction unsigned long long
permitted?
And is there anything like unsigned long double
?
-
2Have you given it a try? – Masked Man Mar 10 '13 at 13:13
-
2Floating point types are never `unsigned`. – Joseph Mansfield Mar 10 '13 at 13:13
-
Giving it a try not necissarily is a good option: Compilers sometimes provide extended types which are non-standard. – johannes Mar 10 '13 at 13:16
-
1@johannes Yes, but *not* giving it a try before asking is not any better. – Masked Man Mar 10 '13 at 13:53
3 Answers
unsigned long long
is fine. (Technically, it's been around since C99, but only since C++11, but every major C++ compiler has been implementing it for quite a long time already.)
There is no such thing as unsigned long double
. Floating point types (at least those available in any language I can think of, and certainly those described by IEEE754 and the C standard) are always signed.

- 16,083
- 3
- 46
- 62
-
3The C spec explicitly says that there are no unsigned floating-point types. – nneonneo Mar 10 '13 at 13:13
Yes, unsigned long long
is permitted because it declares a variable of type long long
that is also unsigned
. The unsigned
keyword can be applied to any integer type, and long long
is indeed an integer type.
There is no such thing as unsigned long double
because long double
is a floating point type (as opposed to an integer type), and there is no such thing as unsigned floating point types (reference 1, reference 2).

- 1
- 1

- 239,200
- 50
- 490
- 574
According to this here, there is aunsigned long long
but only in C++ 11
. About unsigned long double
I am not sure.
Check out the reference,

- 13,029
- 3
- 29
- 42
-
... yeah, but it's been in C since `C99` and every major C++ compiler has been implementing it for years even though it wasn't in the standard until `C++11`. – us2012 Mar 10 '13 at 13:27