472,961 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,961 software developers and data experts.

What is #pragma once used for

What is #pragma once used for
and
what is #WIN#@_LEN_AND_MEAN
Mar 27 '08 #1
5 25135
On 27 Mrz., 06:12, raashid bhatt <raashidbh...@gmail.comwrote:
What is #pragma once used for
and
what is #WIN#@_LEN_AND_MEAN
#pragma once directs the preprocessor of MS Visual C++ to #include the
file only one time per compilation unit, even if more than one
#include for the file is encountered. #pragma is the standard way to
add non-standard behavior to C++; other compilers will just ignore the
line. A better way to achieve the effect would be

xyz.h:

#ifndef _XYZ_H_INCLUDED
#define _XYZ_H_INCLUDED
.... /* remainder of file */
#endif

The definition of the WIN_LEAN_AND_MEAN preprocessor symbol in MS
Visual C++ excludes rarely used stuff from the platform specific
#include files (windows.h, ...).

best,

Michael
Mar 27 '08 #2
On Mar 27, 6:12 am, raashid bhatt <raashidbh...@gmail.comwrote:
What is #pragma once used for
Making code non-portable.
and
what is #WIN#@_LEN_AND_MEAN
Locking you 100% into a specific compiler vendor.

I've never used either in my code, and don't expect I ever will.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Mar 27 '08 #3
On 27 maalis, 11:36, James Kanze <james.ka...@gmail.comwrote:
Locking you 100% into a specific compiler vendor.
I guess other compilers also have compiler specific stuff,
like __attribute() in gcc, which doesn't work in VC++ and
is not a part of C++ standard.
Mar 27 '08 #4
On Mar 27, 11:34 am, Krice <pau...@mbnet.fiwrote:
On 27 maalis, 11:36, James Kanze <james.ka...@gmail.comwrote:
Locking you 100% into a specific compiler vendor.
I guess other compilers also have compiler specific stuff,
like __attribute() in gcc, which doesn't work in VC++ and
is not a part of C++ standard.
And which, of course, I don't use either. (To be fair to
Microsoft: the very name used screamed Windows. It's hard to
pretend that you didn't at least suspect that it wasn't 100%
portable.)

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Mar 27 '08 #5
Mi***************@gmail.com wrote:
On 27 Mrz., 06:12, raashid bhatt <raashidbh...@gmail.comwrote:
>What is #pragma once used for
and
what is #WIN#@_LEN_AND_MEAN

#pragma once directs the preprocessor of MS Visual C++ to #include the
file only one time per compilation unit, even if more than one
#include for the file is encountered. #pragma is the standard way to
add non-standard behavior to C++; other compilers will just ignore the
line. A better way to achieve the effect would be

xyz.h:

#ifndef _XYZ_H_INCLUDED
#define _XYZ_H_INCLUDED
... /* remainder of file */
#endif
<snip>

We actually put BOTH #pragma once and the #ifndef syntax into our header
files.

#pragma once compiles faster; once the compiler has seen it for a .h
file, it doesn't even open the file the 2nd time, whereas the other,
portable, syntax requires the compiler to read the entire file again.
Even though it only requires very light processing it still takes some time.

But this is strictly MS only.

#WIN#@_LEN_AND_MEAN? Never seen it. It sound a bit like the

#define WIN32_LEAN_AND_MEAN that MS use to minimise bloat (as
Christopher put it)

See http://support.microsoft.com/kb/166474

Andy
Mar 27 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
by: Jacob Jensen | last post by:
Hi I have a problem creating C++ code that is multiplatform compilable. My problem is using the "#pragma once" directive which can be used by microsoft Visual Studio pre-compiler but which gives...
187
by: Lasse Espeholt | last post by:
Hi... I am relativ new to the impressive and powerfull C language, but i thinks it is obsolete... The idea with header/source files where methods can clash into eachother i don't like... Look...
7
by: Studlyami | last post by:
Okay I have been wondering this for a while now. I am a little confused on the difference between these two defines #pragma once & #ifndef. From my understanding #pragma is compiler...
26
by: Rick | last post by:
I'm told that "#pragma once" has made it into the ISO standard for either C or C++. I can't find any reference to that anywhere. If it's true, do any of you have a reference I can use? ...
3
by: Subrat | last post by:
Hello, I have used #pragma once in a header file. During compilation I get a warning : #pragma once is obsolete. How do I switch off this warning, without making any change to my make file? ...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.