#pragma????
Does anyone know what the hell #pragma means?? I looked it up in C++ help, but I have v4, so it may be a new thing...
==============================
\\// live long and prosper; \||/ die short and rot.
==============================
Drew Sikora
Executive Producer
GameDev.net
#pragma''s are compiler-specific things, which control how the source code is compiled.
For example, with VC 6 you can use #pragma''s to control the packing of structures, disable specific warnings, or disable optimizations for a specific function.
More info on pragma in VC 6 is at http://msdn.microsoft.com.
For example, with VC 6 you can use #pragma''s to control the packing of structures, disable specific warnings, or disable optimizations for a specific function.
More info on pragma in VC 6 is at http://msdn.microsoft.com.
mhkrause is right
and for example you can use pragma for inlude library files :
#pragma comment (lib, "ddraw.lib") and so on
=============================
Denis "Mr.Snow" Kozhukhov
CEO & Lead programmer
Choco Snow Creation
dkcscPortal
=============================
and for example you can use pragma for inlude library files :
#pragma comment (lib, "ddraw.lib") and so on
=============================
Denis "Mr.Snow" Kozhukhov
CEO & Lead programmer
Choco Snow Creation
dkcscPortal
=============================
=============================Denis "Mr.Snow" KozhukhovCEO & Lead programmerChoco Snow CreationdkcscPortal=============================
Another example: In the Watcom compiler, you used "#pragma aux" to do inline assembly.
-Jussi
-Jussi
The important thing about #pragma''s is that they won''t break your compile. For example:
#pragma this is a stupid pragma
If the compiler doesn''t recognize the #pragma (and in this case its fairly unlikely that it will) it will just ignore it.
I guess this is where most people put a famous quote...
"Everything is funnier with monkey''s" - Unknown
#pragma this is a stupid pragma
If the compiler doesn''t recognize the #pragma (and in this case its fairly unlikely that it will) it will just ignore it.
I guess this is where most people put a famous quote...
"Everything is funnier with monkey''s" - Unknown
--------------------------I guess this is where most people put a famous quote..."Everything is funnier with monkey''s" - Unknown
Thanks everyone - now if I can just ask you to go one step further and try and Identofy these:
1 - #pragma pack(push)
2 - #pragma pack(1)
3 - #pragma pack(pop)
thanks.
==============================
\\// live long and prosper; \||/ die short and rot.
==============================
1 - #pragma pack(push)
2 - #pragma pack(1)
3 - #pragma pack(pop)
thanks.
==============================
\\// live long and prosper; \||/ die short and rot.
==============================
Drew Sikora
Executive Producer
GameDev.net
Push the current pack state onto a stack, set the pack state to byte align, and then pop the original pack state back.
You can also use it to block multiple includes, so instead of
#ifndef SOMETHING_H
#define SOMETHING_H
//blah blah
#endif
you can use:
#pragma once
----------------------------------------
"Before criticizing someone, walk a mile in their shoes.
Then, when you do criticize them, you will be a mile away and have their shoes." -- Deep Thoughts
#ifndef SOMETHING_H
#define SOMETHING_H
//blah blah
#endif
you can use:
#pragma once
----------------------------------------
"Before criticizing someone, walk a mile in their shoes.
Then, when you do criticize them, you will be a mile away and have their shoes." -- Deep Thoughts
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement