Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Miles Bader Newsgroups: comp.lang.c++ Subject: Re: Macro does not work in source code. Date: Tue, 02 Aug 2011 14:53:17 +0900 Organization: NEC Electronics Lines: 28 Message-ID: References: <44d8e695-c63d-4453-b405-4902416f265c@h14g2000yqd.googlegroups.com> <87r557n5fu.fsf@gmail.com> <7a284$4e357ef3$506c0d9c$25382@news.chello.at> Mime-Version: 1.0 Content-Type: text/plain X-Trace: individual.net A1IW9EmOcj7wca+i353B8QLvZM8Bz5c7y5AcblIVNUeQBm1Y+4 Cancel-Lock: sha1:E+i46Frw4s/32K1O6yNZuThZ4wo= sha1:Cd3mB6cR7n59GFZjsqym562e6SQ= System-Type: x86_64-unknown-linux-gnu Blat: Foop Xref: x330-a1.tempe.blueboxinc.net comp.lang.c++:8396 Jorgen Grahn writes: > On Sun, 2011-07-31, Alf P. Steinbach wrote: >>> However, the GNU docs references above says "#pragma once" is obsolete. >>> >>> That's a pretty weird statement. >> >> Oh, the more recent GNU docs, for version 4.6, do not say obsolete: >> >> http://gcc.gnu.org/onlinedocs/gcc-4.6.1/cpp/Alternatives-to-Wrapper-_0023ifndef.html#Alternatives-to-Wrapper-_0023ifndef > > Oh -- it didn't occur to me to look in the cpp manual (although it > should have). > > I note though that (a) I've never seen it used, and (b) on my system > none of the 2800 files in /usr/include use it. It seems clear that, at least in portable code, the #ifdef... solution is both idiomatic and the "safe choice" (will work in any compiler), which seem a good reason to prefer it, especially considering it's _also_ efficient with many common compilers (dunno about microsoft compilers). -Miles -- `...the Soviet Union was sliding in to an economic collapse so comprehensive that in the end its factories produced not goods but bads: finished products less valuable than the raw materials they were made from.' [The Economist]