Why can't you define an external object twice and never use it?

Walter Murray walter at hpclwjm.HP.COM
Tue Nov 14 04:32:32 AEST 1989


Paul Eggert writes:

> The program
> 	int X = 0;
> 	int X = 0;
> 	main() { return 0; }
>is ``obviously'' not ANSI C, but where does the proposed ANSI standard say so?
>X has multiple external definitions with external linkage, but X is never used.

I think it's even worse.  As far as I can tell, even the following 
program is strictly conforming, but I'll be happy if someone can
prove otherwise.

      int object = 1;
      int object = 2;
      function () { return 3; }
      function () { return 4; }
      main () { }

Looks like an oversight in the dpANS.

Walter Murray
---



More information about the Comp.std.c mailing list