Global Definition Vs Global Declaration
Ian Lance Taylor
iant@google.com
Wed Apr 4 18:40:00 GMT 2012
zahed khurasani <sdzahed@gmail.com> writes:
> How can I distinguish between the following two declarations (both
> appear outside any function at file scope)?
>
> extern int i;
> int i;
>
> Both show up as VAR_DECL nodes in the BLOCK_VARS of the
> TRANSLATION_UNIT_DECL. Moreover, both return true for DECL_EXTERNAL. I
> need a way to say which is which in my plugin code.
I assume this is C, not C++, and that you are not using the -fno-common
option. The "int i;" will be DECL_COMMON.
Ian
More information about the Gcc-help
mailing list