[comp.std.c] Macro-created # directives

diamond@csl.sony.co.jp (Norman Diamond) (09/29/89)

Consider the following sample program:

  #define junk #include <garbage.h>
  junk

Does my preprocessor have to include <garbage.h>?


Note that this is different from the situation mentioned in the
standard.  For the following sample program:

  #define junk2(arg) arg
  junk2(#include <garbage.h>)

the standard says that the behavior is undefined.

-- 
Norman Diamond, Sony Corporation (diamond@ws.sony.junet)
  The above opinions are inherited by your machine's init process (pid 1),
  after being disowned and orphaned.  However, if you see this at Waterloo or
  Anterior, then their administrators must have approved of these opinions.

gwyn@smoke.BRL.MIL (Doug Gwyn) (10/14/89)

In article <10891@riks.csl.sony.co.jp> diamond@ws.sony.junet (Norman Diamond) writes:
>  #define junk #include <garbage.h>
>  junk
>Does my preprocessor have to include <garbage.h>?

No, in fact the Standard explicitly prohibits it being treated as a
preprocessing command.