Patrick
Patrick

Reputation: 2337

Why does gcc have a warning for long long?

What is the reason for the -Wlong-long gcc warning?

From the gcc man page:

-Wlong-long
       Warn if long long type is used.  This is enabled by either -Wpedantic or -Wtraditional in ISO C90 and C++98 modes.  To inhibit the warning messages, use -Wno-long-long.

As I understand it, long long is required to be at least 64-bits (practically it is always 64-bits, at least with today's compilers). Was this not the case for ISO C90 or C++98, or is there some other reason not to use long long?

I know about <stdint.h> types like int64_t and friends, but some not-so-old compilers (e.g. VS2005, and Green Hills ARM 3.5) do not provide <stdint.h>, and I thought long long would be (at least) 64 bits for those and newer toolchains.

Upvotes: 36

Views: 12116

Answers (1)

a3f
a3f

Reputation: 8657

There was no long long type yet in ISO C90 and C++98. It has only been added in ISO C99 and C++11.

GCC provided it as an extension prior to standardization, though.

Upvotes: 43

Related Questions