Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 596
Patrick Avatar asked Jul 21 '16 15:07

Patrick


People also ask

How do I stop a GCC warning?

To answer your question about disabling specific warnings in GCC, you can enable specific warnings in GCC with -Wxxxx and disable them with -Wno-xxxx. From the GCC Warning Options: You can request many specific warnings with options beginning -W , for example -Wimplicit to request warnings on implicit declarations.

What is GCC warning?

Warnings are diagnostic messages that report constructions that are not inherently erroneous but that are risky or suggest there may have been an error. The following language-independent options do not enable specific warnings but control the kinds of diagnostics produced by GCC.

How do I ignore a warning in Makefile?

Maybe you can look for CFLAGS options in Makefile and remove the -Werror flag. The Werror flag will make all warnings into errors. Show activity on this post. In general, it is not a good idea to ignore warnings from your compiler.

Which GCC flag is used to enable all compiler warnings?

gcc -Wall enables all compiler's warning messages. This option should always be used, in order to generate better code.


1 Answers

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.

like image 60
a3f Avatar answered Oct 09 '22 22:10

a3f