Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Brian Casiello Newsgroups: comp.lang.c++ Subject: Re: Macro does not work in source code. Date: Sat, 30 Jul 2011 11:39:33 -0400 Organization: A noiseless patient Spider Lines: 22 Message-ID: <87r557n5fu.fsf@gmail.com> References: <44d8e695-c63d-4453-b405-4902416f265c@h14g2000yqd.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: mx04.eternal-september.org; posting-host="FWc/DP/OMMsgCfZpfDSr4g"; logging-data="12115"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+QFBqrDvKVozXEW0uVY488DDlBVbxsEdE=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (windows-nt) Cancel-Lock: sha1:evqgnbmoKOA4/l2slDFS3OAIdWY= sha1:oDyX06s2hz0Pv7HBb/Ic26qewYc= Xref: x330-a1.tempe.blueboxinc.net comp.lang.c++:8332 Jorgen Grahn writes: > On Sat, 2011-07-30, MJ_India wrote: >> On Jul 29, 9:36 am, Nephi Immortal wrote: > >> [Prefer to use #pragma once instead of ifndef guards] > > That last sentence -- is that supposed to be an advice? I've never > seen anything other than the include guard stuff you described above. > And my compiler (g++) doesn't seem to have a pragma named "once". It's a Microsoft Visual-C++ thing, it means the header should only be opened and read once. It's effectively equivalent to include guards and may speed up compiles as long as you know your code is and will always be VC++ specific (it depends on other Microsoft-isms), or if you don't care that your code will only compile efficiently with Visual C++. I suppose you could use both, and get the MS speed tweak and portability. -- Brian