[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] - Reine Interessensfrage zu gcc-Meldung



"Bruno Hertz" <brrhtz@yahoo.de> writes:

> a.c:
>  #include "a.h"
>  int x=2; /* hier kriegen wir jetzt eigentlich #define blah 5x=2; */
>  int main() {
>   ...
>  }
>

Sorry, das sollte natürlich heissen

 /* hier kriegen wir jetzt eigentlich #define blah 5int x=2; */

Und weil wir dabei sind hier nochmal der Text aus ISO/IEC 9899:1999


 6.10.2 Source file inclusion

   Constraints

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

   Semantics

   2 A preprocessing directive of the form

   # include <h-char-sequence> new-line

   searches a sequence of implementation-defined places for a header
   identified uniquely by the specified sequence between the < and >
   delimiters, and causes the replacement of that directive by the
   entire contents of the header. How the places are specified or the
   header identified is implementation-defined.


Insbesondere ist das Newline auf der #include Zeile Teil der (und
jeder Präprozessor) Direktive, würde also laut Standard mit ersetzt.

Wenn ich den Standard weiter durchwühlte würde ich wahrscheinlich
einen expliziten Hinweis finden, daß Implementierungen (i.e. Compiler)
zu fehlenden Newlines am Dateiende Warnungen ausgeben sollen. Im ANSI
C Standard hat's den nämlich gegeben ...

Gruss, Bruno.



Reply to: