r/cpp_questions • • Aug 31 '25

OPEN What is long long

I saw some c++ code and I noticed it has long long, I never knew you could put 2 primitives next to each other. What does this do?

1 Upvotes

37 comments sorted by

View all comments

13

u/y53rw Aug 31 '25 edited Aug 31 '25

All of the fundamental types are here.

https://en.cppreference.com/w/cpp/language/types.html

Note that some types can be written multiple ways. long long can also be written long long int or signed long long int or signed long long.

7

u/Warshrimp Aug 31 '25

Wouldn't it be great if char = 8, short = 16, int = 32, long = 64 and long long were 128? I hope the next time someone treats a new data model they stick with this.

1

u/DrShocker Aug 31 '25

In my opinion, char and uint8 shouldn't be considered synonyms since the kinds of operations you want to do with a byte or an 8 bit integer might reasonably be wrong if they get mix.

2

u/TomDuhamel Aug 31 '25

I don't disagree. The relationship is logistical unfortunately.