public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* help regarding "-ansi" flag
@ 2009-03-14 10:09 Sayali Surve
  2009-03-16 19:04 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Sayali Surve @ 2009-03-14 10:09 UTC (permalink / raw)
  To: gcc-help


Hi,

For gcc 4.1.2, as per the man page of gcc, the default standard is gnu89 i.e. ISO C90 plus GNU extensions. 
"-ansi" also supports ISO C90 programs.
Is the difference in using and not using "-ansi" flag is not enabling GNU extensions and enabling GNU extensions or is there any other difference as well??

Thanks for help,
S



      Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: help regarding "-ansi" flag
  2009-03-14 10:09 help regarding "-ansi" flag Sayali Surve
@ 2009-03-16 19:04 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2009-03-16 19:04 UTC (permalink / raw)
  To: Sayali Surve; +Cc: gcc-help

Sayali Surve <sayalisurve@yahoo.com> writes:

> For gcc 4.1.2, as per the man page of gcc, the default standard is gnu89 i.e. ISO C90 plus GNU extensions. 
> "-ansi" also supports ISO C90 programs.
> Is the difference in using and not using "-ansi" flag is not enabling GNU extensions and enabling GNU extensions or is there any other difference as well??

I think the gcc 4.1 manual is pretty clear.  Quoting

http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/C-Dialect-Options.html#C-Dialect-Options

    This turns off certain features of GCC that are incompatible with
    ISO C90 (when compiling C code), or of standard C++ (when compiling
    C++ code), such as the asm and typeof keywords, and predefined
    macros such as unix and vax that identify the type of system you are
    using. It also enables the undesirable and rarely used ISO trigraph
    feature. For the C compiler, it disables recognition of C++ style
    `//' comments as well as the inline keyword.

    The alternate keywords __asm__, __extension__, __inline__ and
    __typeof__ continue to work despite -ansi. You would not want to use
    them in an ISO C program, of course, but it is useful to put them in
    header files that might be included in compilations done with
    -ansi. Alternate predefined macros such as __unix__ and __vax__ are
    also available, with or without -ansi.

    The -ansi option does not cause non-ISO programs to be rejected
    gratuitously. For that, -pedantic is required in addition to
    -ansi. See Warning Options.

    The macro __STRICT_ANSI__ is predefined when the -ansi option is
    used. Some header files may notice this macro and refrain from
    declaring certain functions or defining certain macros that the ISO
    standard doesn't call for; this is to avoid interfering with any
    programs that might use these names for other things.

    Functions which would normally be built in but do not have semantics
    defined by ISO C (such as alloca and ffs) are not built-in functions
    with -ansi is used. See Other built-in functions provided by GCC,
    for details of the functions affected.

If you have any questions about that, can you be more specific?

Ian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-03-16 19:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-14 10:09 help regarding "-ansi" flag Sayali Surve
2009-03-16 19:04 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).