[comp.std.c] #ifs and their corresponding #endifs -- in same file?

jsa@edg1.UUCP (J. Stephen Adamczyk) (04/19/89)

Anyone care to venture an opinion or whether or not the pANS requires
that an #if (or the like) be closed by a corresponding #endif in
the SAME source file?

Steve Adamczyk

henry@utzoo.uucp (Henry Spencer) (04/21/89)

In article <335@edg1.UUCP> jsa@edg1.UUCP (J. Stephen Adamczyk) writes:
>Anyone care to venture an opinion or whether or not the pANS requires
>that an #if (or the like) be closed by a corresponding #endif in
>the SAME source file?

If you look hard at the grammar for the preprocessor, it is fairly clearly
the grammar for a *single* file.  Everybody I know of who has studied the
matter closely has concluded that #if-#endif must match within the same file.
-- 
Mars in 1980s:  USSR, 2 tries, |     Henry Spencer at U of Toronto Zoology
2 failures; USA, 0 tries.      | uunet!attcan!utzoo!henry henry@zoo.toronto.edu

gwyn@smoke.BRL.MIL (Doug Gwyn) (04/21/89)

In article <335@edg1.UUCP> jsa@edg1.UUCP (J. Stephen Adamczyk) writes:
-Anyone care to venture an opinion or whether or not the pANS requires
-that an #if (or the like) be closed by a corresponding #endif in
-the SAME source file?

Of course it does.  See the preprocessing grammar.