|
-
March 17th, 2009, 12:31 PM
#1
Is #pragma once ok to use as a guard mechanism?
Hello,
sometimes I see guard mechanisms in .h files like so:
#ifndef _CLASSNAME_H_
#define _CLASSNAME_H_
...
#endif //(_CLASSNAME_H_)
doesnt "#pragma once" do the exact same thing but in one line of code? Why would anyone use the first method instead of "#pragma once" ?
Thank you,
Ellay
-
March 17th, 2009, 12:36 PM
#2
Re: Is #pragma once ok to use as a guard mechanism?
pragmas are not standard. -> if you want to be able to compile your code with different compilers it's better to use ordinary include guards.
kurt
-
March 21st, 2009, 07:18 AM
#3
Re: Is #pragma once ok to use as a guard mechanism?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|