Thread: What is the Difference between ANSI C and non-ANSI C ?

  1. #1

    What is the Difference between ANSI C and non-ANSI C ?

    Hi !!,
    I wanted to know as to what is the difference between ANSI C and non-ANSI C ? This surely has to do something with the type of compilers used but then whats the precise difference ?
    Is the C compiler provided with Linux ANSI compliant ? I would be extremely thankful if anyone could tell me the difference.

  2. #2
    Registered User
    Join Date
    Nov 2001
    There were a lot of compilers uncompatible with each other before a standardization was set by ANSI in 1988. For example the following code may work on some compilers and won't in others.

    printf("st" "sd" "45");

    The compatible one was
    printf("st" , "sd" , "45");

    So ANSI set standards for some basic libaries, basic keywords, language rules. Today nearly all of the compilers you will find are ANSI C compliants. This means that they all support the ANSI rules. However they may add new features which are not present in ANSI C.

    The C compiler in Linux, gcc, is also ANSI C compliant. But some improvements are made for better code generation.
    man gcc
    and see how these are arranged by various flags.

Popular pages Recent additions subscribe to a feed