C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

#endif BLA

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (German)
View previous topic :: View next topic  
Author Message
Michael Trocken
Guest





PostPosted: Tue Sep 23, 2003 8:32 am    Post subject: #endif BLA Reply with quote



In manchen Quelltexten sieht man folgende Präprozessoranweisungen:

#ifdef BLA

...

#endif BLA

Dabei wird hinter dem #endif sozusagen als Kommentierung die Bedingung
für das #ifdef noch einmal wiederholt.

Ist das standardkonform, oder müsste der Compiler eine Fehlermeldung ausgeben?


Gruß,
Michael

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
Back to top
Christoph Rabel
Guest





PostPosted: Tue Sep 23, 2003 8:56 am    Post subject: Re: #endif BLA Reply with quote



Michael Trocken wrote:
Quote:
In manchen Quelltexten sieht man folgende Präprozessoranweisungen:

#ifdef BLA

...

#endif BLA

Dabei wird hinter dem #endif sozusagen als Kommentierung die Bedingung
für das #ifdef noch einmal wiederholt.

Ist das standardkonform, oder müsste der Compiler eine Fehlermeldung ausgeben?

Laut Kapitel 16 des Standards hat die #endif Direktive so auszusehen:

# endif newline

Daher ist obiges Verhalten nicht standardkonform.

mfg

Christoph

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Immanuel Albrecht
Guest





PostPosted: Tue Sep 23, 2003 1:10 pm    Post subject: Re: #endif BLA Reply with quote



[email]s1234569 (AT) hotmail (DOT) com[/email] (Michael Trocken) wrote in
news:91267dba.0309230032.55de3440 (AT) posting (DOT) google.com:

Quote:
In manchen Quelltexten sieht man folgende Präprozessoranweisungen:

#ifdef BLA

...

#endif BLA

Dabei wird hinter dem #endif sozusagen als Kommentierung die Bedingung
^^^^^^^^^^^^^
für das #ifdef noch einmal wiederholt.

Kann es sein, dass du
#ifdef AFFE_TOT
#endif //AFFE_TOT

meinst? Das müsste in der Tat konform sein und ist auch die Variante die
ich selber oft sehe, und da ich die andere Variante noch nicht sah, dachte
ich vielleicht an einen Schreibfehler.
--
http://xrxixpx.rip-productions.de

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Michael Trocken
Guest





PostPosted: Tue Sep 23, 2003 5:13 pm    Post subject: Re: #endif BLA Reply with quote

Immanuel Albrecht <xrxixpx (AT) gmx (DOT) de> wrote

Quote:
s1234569 (AT) hotmail (DOT) com (Michael Trocken) wrote in
news:91267dba.0309230032.55de3440 (AT) posting (DOT) google.com:

In manchen Quelltexten sieht man folgende Präprozessoranweisungen:

#ifdef BLA

...

#endif BLA

Dabei wird hinter dem #endif sozusagen als Kommentierung die Bedingung
^^^^^^^^^^^^^
=========


Quote:
für das #ifdef noch einmal wiederholt.

Kann es sein, dass du
#ifdef AFFE_TOT
#endif //AFFE_TOT

meinst? Das müsste in der Tat konform sein und ist auch die Variante die
ich selber oft sehe, und da ich die andere Variante noch nicht sah, dachte
ich vielleicht an einen Schreibfehler.

Nein, meinte ich nicht. Trotzdem danke für den Hinweis.
Beispielsweise compiliert der Borland-Compiler

#endif BLA

ohne zu mucken.


Mit

#endif // AFFE_TOT

kann man bei älteren Präprozessoren übrigens ebenso auflaufen, denn
manche davon kennen die C++-Kommentare nicht.

Dann hilft nur noch

#endif /* HIER_GILT_DIE_STVO */


Michael

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Jörg Baumann
Guest





PostPosted: Tue Sep 23, 2003 10:07 pm    Post subject: Re: #endif BLA Reply with quote

Michael Trocken wrote:

Quote:
Mit

#endif // AFFE_TOT

kann man bei älteren Präprozessoren übrigens ebenso auflaufen, denn
manche davon kennen die C++-Kommentare nicht.

Das sollte für einen C++ Compiler (de.lang.iso-c++) aber wirklich kein
Problem sein.

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Christoph Rabel
Guest





PostPosted: Tue Sep 23, 2003 10:35 pm    Post subject: Re: #endif BLA Reply with quote

Jörg Baumann wrote:
Quote:
Michael Trocken wrote:


Mit

#endif // AFFE_TOT

kann man bei älteren Präprozessoren übrigens ebenso auflaufen, denn
manche davon kennen die C++-Kommentare nicht.

Das sollte für einen C++ Compiler (de.lang.iso-c++) aber wirklich kein
Problem sein.

Du hast zwar streng genommen recht, das wir hier nur iso-c++
besprechen, nur wenn man die Praxis ganz ausser acht lässt
artet das in Hirnwichserei aus.

Leider leben wir eben in einer unvollkommenen Welt...

mfg

Christoph

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.