Re: gcc 10: Default to -fno-common, multiple definitions of ...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Miro Hrončok wrote:
> https://gcc.gnu.org/gcc-10/porting_to.html#common
> 
> "Default to -fno-common
> 
> A common mistake in C is omitting extern when declaring a global variable
> in a header file. If the header is included by several files it results in
> multiple definitions of the same variable. In previous GCC versions this
> error is ignored. GCC 10 defaults to -fno-common, which means a linker
> error will now be reported. To fix this, use extern in header files when
> declaring global variables, and ensure each global is defined in exactly
> one C file. As a workaround, legacy C code can be compiled with -fcommon.
> 
> 
>        int x;  // tentative definition - avoid in header files
> 
>        extern int y;  // correct declaration in a header file"

I fail to see how this kind of incompatible change that breaks hundreds of 
packages (and certainly a lot more software out there) is an improvement.

        Kevin Kofler
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux