Search code examples
ccompiler-construction32-bit16-bit8-bit

Difference between C 8 bit 16-bit 32-bit compilers


This question may be redundant, but I didn't found exact answer.

What is the Difference between C 8 bit 16-bit 32-bit compilers.

how the .exe differ generated by different compilers for same code...........


Solution

  • 16 bit compilers compile the program into 16-bit machine code that will run on a computer with a 16-bit processor. 16-bit machine code will run on a 32-bit processor, but 32-bit machine code will not run on a 16-bit processor. 32-bit machine code is usually faster than 16-bit machine code.

    With 16 bit compiler the type-sizes (in bits) are the following:

    short, int: 16 
    long: 32 
    long long: (no such type) 
    pointer: 16/32 (but even 32 means only 1MB address-space on 8086) 
    

    With 32 bit compiler the object-sizes (in bits) are the following:

    short: 16 
    int, long: 32 
    long long: 64 
    pointer: 32 
    

    With 64 bit compiler the object-sizes (in bits) are the following:

    short: 16 
    int: 32 
    long: 32 or 64 (!) 
    long long: 64 
    pointer: 64 
    

    [While the above values are generally correct, they may vary for specific Operating Systems. Please check your compiler's documentation for the default sizes of standard types]

    Following can explain a little bit more... http://cboard.cprogramming.com/c-programming/96536-16-bit-compilar-32-bit-compilar.html