#define ANSI_COMPILE
Taavi Burns
taavi-LbuTpDkqzNzXI80/IeQp7B2eb7JE58TQ at public.gmane.org
Wed Feb 11 16:09:09 UTC 2004
On Wed, Feb 11, 2004 at 11:36:38AM +0000, Alex Bobby wrote:
>
> Hello,
>
> I went through man page about GCC for '-ansi' compilalation and am not clear about the usage.
gcc source.c -o program -ansi
That will require strict ANSI C compliance from the source code. There are some things which
gcc allows which are not strictly ANSI; that flag disables those things.
> How can the code be customized if the macro
>
> #define ANSI_COMPILE
>
> is used at the beginning of the implementation file.
That question makes no sense to me. The -ansi flag probably enables a #define or two so
that source code can 'know' that it's being compiled by a strictly ANSI compiler. your
question does not make sense, though. What customisation are you talking about?
The #define directive simply defines that symbol for the C preprocessor. Look elsewhere
in the code to see any #if ANSI_COMPILE statements which would cause parts of the code
to be stripped/enabled. The -ansi flag will have no effect on the line of code you
quoted.
Or are you saying that the GCC manpage specifies that -ansi causes the equivalent
to #define ANSI_COMPILE for the preprocessor? In that case one would do the
following in the code:
#if ANSI_COMPILE
// Code here that is ANSI-only
#else
// Code here that is non-ANSI
#endif
If you've never seen C preprocessor constructs, go find a good tutorial on C, or pick
up a good C book. Opinions vary, but invariably include K&R's "The C Programming
Language, 2nd ed" as a reference manual.
--
taa
In order to solve the problems of violence,
we need to transform our culture.
--Bruce D. Perry
/*eof*/
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list