views:

107

answers:

2

Is there anything equivalent to #pragma once for Codegear RAD Studio 2009?

I am using the precompiled header wizard and I would like to know if it is still necessary to use include guards when including header files?

+1  A: 

Rad Studio supports #pragma once, along with all of the following.

JRL
Excellent. The installed help must have been out of date.
Seth
Please note that support for #pragma once was only added in C++Builder 2010 and was not available in C++Builder 2009 and earlier.
David Dean - Embarcadero
oh in that case - unmarking as correct answer. @David you should post that comment as the correct answer.
Seth
@David see follow up question regarding if 2009 has header-include-guard-optimisation, even though it doesn't use the `#pragma once` directive. http://stackoverflow.com/questions/2233401/are-redundant-include-guards-necessary
Seth
+3  A: 

Support for #pragma once was added in C++Builder 2010 In C++Builder 2009 and earlier, the unknown pragma will simply be ignored. I would suggest using

#ifndef X 
#define X
//code 
#endif

style header guards in the versions of C++Builder that do not support #pragma once.

David Dean - Embarcadero