Re: help regarding "-ansi" flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sayali Surve <sayalisurve@xxxxxxxxx> 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

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux