Mail Archives: djgpp/1997/08/15/23:03:11
On Tue, 12 Aug 1997 07:25:13 GMT, "Guan Foo Wah" <jgfw AT usa DOT net> wrote:
>I have seem many source code with the word #pragma. I do not know what
>this means. My C book (Teach Yourself C in 21 Days) did not give me any
>info about this. The only thing I know is it is a preprocessor command.
>
>
>Can anyone care to explain to me what is #pragma. Is it ANSI
>compatible ??
The #pragma directive is like a signal to the compiler to do something
special (like turn off some types of warnings (Borland's #pragma
argsused) or to do compiler dependent operations such as #pragma
pack). Alot of times #pragma's are compiler dependent (that's
actually what they are for so a compiler can implement compiler
specific options without interferring with other compilers) so if you
want truly portable code always include #pragma's in #ifdef <compiler>
#endif blocks. If a compiler doesn't recognize a #pragma it is
supposed to ignore it but MSVC++ 4.1 doesn't tend to do this so I put
them in the blocks just to be sure.
Lonnie McCullough
lonniem AT cs DOT utexas DOT edu
- Raw text -