https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92720

--- Comment #7 from Dennis Clarke <dclarke at blastwave dot org> ---

Looking at the document n1256 "ISO/IEC 9899:TC3 WG14/N125" ye C99
specifications we see section 6.10.2 Source file inclusion subsection 1
which almost seems clear : 

    A #include directive shall identify a header or source file
    that can be processed by the implementation.

Sort of a vague idea there. Whatever "can be" means.  However the file
/dev/stdin really is neither a "header" nor is it a "source" file.

As people are saying, this is all "implementation" defined perhaps. I
feel that no file shall be included if it is neither a "source" file
nor a valid "header". No idea how one would verify such a condition at
the pre-processing translation stage.

However I also see : 

    5.1.1.2 Translation phases

        The precedence among the syntax rules of translation is
        specified by the following phases.[5]

        1. Physical source file multibyte characters are mapped, in
           an implementation-defined manner, to the source character
           set (introducing new-line characters forend-of-line
           indicators) if necessary. Trigraph sequences are replaced
           by corresponding single-character internal representations.

Where the footnote [5] states : 

     5 Implementations shall behave as if these separate phases
       occur, even though many are typically folded together in
       practice. Source files, translation units, and translated
       translation units need not necessarily be stored as files,
       nor need there be any one-to-one correspondence between these
       entities and any external representation. The description
       is conceptual only, and does not specify any particular
       implementation.


That seems to imply I could just as easily do an include of /dev/random.

Dennis

Reply via email to