Difference between C 8 bit 16-bit 32-bit compilers [closed]
Asked Answered
M

3

4

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...........

Mealy answered 5/4, 2013 at 6:39 Comment(2)
Is this a theoretical question, or do you have some specific compilers/architectures in mind?Woolfell
I don't know exactly, I just want to know the basic difference. If some body is expecting .exe generated by 8 bit compiler like amtel, and I give .exe generated by 32 bit compiler like GCC what makes the difference.. Sorry Am really poor in this.......Mealy
I
6

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

Ingoing answered 5/4, 2013 at 6:43 Comment(2)
While this is probably mostly true, you're oversimplifying a lot. I recommend section 5.2.4.2.1 of the C11 standard.Chloechloette
Not every 32-bit processor is backward compatible with some 16-bit instruction set. And the popular 16-bit Motorola 68000 (used in Sega Megadrive for example) is forward compatible with 32-bit code. So it's not really that simple.Nazi
A
2

not all compilers generate .exe for starters, different platforms have different forms you can give it code.

8bit compilers target microprocessors with 8 bit registers, same for 16 bit and 32 bit, and also 64 bit. Depending on the microprocessor each often has there on addressing scheme also for memory and hardware.

for each of 8/16/32/64 bit C compilers, there are many compilers targetting different micros. Each will do various optimizations for each platform. So...

They are all quite different.

Abracadabra answered 5/4, 2013 at 6:43 Comment(0)
T
0

it depends also on the processor register bit. the 32bit compiler can compile into 32bit machine code which can be run only on 32bit and 64bit microprocessor. But not less than 32 bit.

Trilly answered 5/4, 2013 at 7:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.