This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
#pragma interface and #pragma implementation
- From: "Steven T. Hatton" <hattons at globalsymmetry dot com>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 1 Jun 2004 15:42:42 -0400
- Subject: #pragma interface and #pragma implementation
- Organization: Global Symmetry
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I've been experimenting with the #pragma directives described in the following
section of the GCC documentation:
http://gcc.gnu.org/onlinedocs/gcc-3.4.0/gcc/C---Interface.html#C++%20Interface
I'm not really sure how to use these. What I believe the document is saying is
I should put `#pragma interface' in my 'header' files.
I'm not sure of the placement of the directive relative #include directives.
I expect the `#pragma interface' directive to influence the processing of any
files #included after it appears. I am not sure of the consequence of this
on such items as the standard headers, or third party library headers.
Should the `#pragma interface' be the first directive in the header file?
Should I have include guards in the headers using the `#pragma interface'?
For the sake of clarity I provide this example of an '#include guard:
#ifndef _INPUT_BOX_H_
#define _INPUT_BOX_H_
// C++ declarations go here
#endif
If I #include a header containing a '#pragma interface' directive in another
header, do I need to do anything special such as use a `#pragma interface
"filename.h"' directive?
In the source file I believe I should put directives of the form demonstrated
by these:
#pragma implementation "InputBox.h"
#include "InputBox.h"
#pragma implementation "Pragmatic.h"
#include "Pragmatic.h"
The only exception to this would be if my header and source share the same
base name. In that case `#pragma implementation' should suffice. Is that
correct?
Are there any examples of the use of these directive available online? Where?
- --
Regards,
Steven
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQFAvNw9wX61+IL0QsMRAmXYAKDNCObBgV1T5Mwk3tZD6gtuF9cR/ACfR2Al
Cdh5aCEU8jXnTpKdnRJ7S0M=
=Anen
-----END PGP SIGNATURE-----