Problems with GCC and/or VAX LINK
Doug Gwyn
gwyn at smoke.BRL.MIL
Sat Mar 11 05:19:14 AEST 1989
In article <1680 at levels.sait.edu.au> ccdn at levels.sait.edu.au (DAVID NEWALL) writes:
-1. GCC doesn't allow mismatched quotation marks. For example:
- /* this isn't going to work */
- I've seen arguments over this behaviour before ...
I don't see any grounds for argument. C has always permitted arbitrary
text in a comment, terminated when "*/" first occurs. Syntax checking
of the contents of a comment is simply wrong.
-3. My investigations into "globalref" high-lighted a problem with either
- the VMS linker, or with both GCC and VAX C. Essentialy, I can compile,
- link and execute the following program:
- extern v1;
- int v2;
- main() {
- printf("&v1=%d\n&v2=%d\n", &v1, &v2);
- exit(1);
- }
- Compiling with GCC, I get &v1 == &v2. Compiling with VAX C I get
- &v1 + 4 == &v2. In either case, I think it's wrong. I think that
- I should get a linker error complaining about an undefined external
- variable (v1).
Technically that's correct. No storage has been allocated for `v1'.
A common extension found in many C implementations (especially on UNIX)
is to treat "extern" in such a context like Fortran COMMON, allocating
at link time the largest storage thus referenced, if no explicit
storage definition has been provided. It sounds like VAX C follows that
COMMON model. I don't know of any way that the reported GCC behavior
could be considered correct.
More information about the Comp.lang.c
mailing list