Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #8396

Re: Macro does not work in source code.

From Miles Bader <miles@gnu.org>
Newsgroups comp.lang.c++
Subject Re: Macro does not work in source code.
Date 2011-08-02 14:53 +0900
Organization NEC Electronics
Message-ID <buoaabsfjg2.fsf@dhlpc061.dev.necel.com> (permalink)
References (4 earlier) <7a284$4e357ef3$506c0d9c$25382@news.chello.at> <slrnj3b7pb.gtj.grahn+nntp@frailea.sa.invalid> <j14m3v$3i9$1@dont-email.me> <j14mc6$3i9$2@dont-email.me> <slrnj3d5s9.gtj.grahn+nntp@frailea.sa.invalid>

Show all headers | View raw


Jorgen Grahn <grahn+nntp@snipabacken.se> 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]

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Macro does not work in source code. Nephi Immortal <immortalnephi@gmail.com> - 2011-07-28 17:36 -0700
  Re: Macro does not work in source code. Sam <sam@email-scan.com> - 2011-07-28 20:41 -0500
  Re: Macro does not work in source code. red floyd <no.spam.here@its.invalid> - 2011-07-28 23:45 -0700
    Re: Macro does not work in source code. Juha Nieminen <nospam@thanks.invalid> - 2011-07-29 10:01 +0000
      Re: Macro does not work in source code. "Alf P. Steinbach" <alf.p.steinbach:usenet@gmail.com> - 2011-07-29 13:31 +0200
  Re: Macro does not work in source code. MJ_India <mail.mohitjain@gmail.com> - 2011-07-29 23:41 -0700
    Re: Macro does not work in source code. Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-07-30 12:58 +0000
      Re: Macro does not work in source code. Brian Casiello <bcasiello@gmail.com> - 2011-07-30 11:39 -0400
        Re: Macro does not work in source code. Paul Brettschneider <paul.brettschneider@yahoo.fr> - 2011-07-31 18:12 +0200
          Re: Macro does not work in source code. Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-07-31 18:30 +0000
            Re: Macro does not work in source code. "Alf P. Steinbach" <alf.p.steinbach:usenet@gmail.com> - 2011-08-01 00:48 +0200
              Re: Macro does not work in source code. "Alf P. Steinbach" <alf.p.steinbach:usenet@gmail.com> - 2011-08-01 00:52 +0200
                Re: Macro does not work in source code. Paul Brettschneider <paul.brettschneider@yahoo.fr> - 2011-08-01 08:58 +0200
                Re: Macro does not work in source code. "Alf P. Steinbach" <alf.p.steinbach:usenet@gmail.com> - 2011-08-01 10:11 +0200
                Re: Macro does not work in source code. James Kanze <james.kanze@gmail.com> - 2011-08-07 11:00 -0700
                Re: Macro does not work in source code. "Alf P. Steinbach" <alf.p.steinbach:usenet@gmail.com> - 2011-08-07 22:50 +0200
                Re: Macro does not work in source code. Ian Collins <ian-news@hotmail.com> - 2011-08-08 09:15 +1200
                Re: Macro does not work in source code. Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-08-01 12:09 +0000
                Re: Macro does not work in source code. Miles Bader <miles@gnu.org> - 2011-08-02 14:53 +0900
              Re: Macro does not work in source code. Ian Collins <ian-news@hotmail.com> - 2011-08-01 10:55 +1200
      Re: Macro does not work in source code. James Kanze <james.kanze@gmail.com> - 2011-08-07 10:47 -0700
        Re: Macro does not work in source code. Marc <marc.glisse@gmail.com> - 2011-08-07 18:13 +0000

csiph-web