This is the mail archive of the gas2@sourceware.cygnus.com mailing list for the gas2 project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
The case which causes trouble is when a program uses a common variable (an uninitialized variable in C; most languages, including C++, have no notion of common variables). ANSI/ISO C also does not have common variables. A program with multiple external definitions of a variable has undefined behaviour. However, C compilers that make this work by treating uninitialized variables as common are so prevalent that most people aren't aware of this. This particular feature is mentioned in the `Common Extensions' appendix, in the section `Multiple External Definitions'. This also means that, technically, if you want to make sure that other ANSI/ISO C compilers can compile your code, you must use -fno-common in addition to -ansi and -pedantic. Jim