16-bit int

David Brown david@westcontrol.com
Thu Aug 9 13:45:00 GMT 2012


On 09/08/2012 13:26, Göran Steen wrote:
> Hi!
>
> I use gcc version 4.3.4, where int is 32-bit variables. Is it
> possible to setup compiler to compile int as 16-bit variables?
>
> With best regards / Med vänlig hälsning / Mit freundlichen Grüßen /
> Saudações
>
> Göran Steen


The size of an int depends on the target - gcc supports dozens of 
targets.  Most have 32-bit ints, but some have 16-bit ints and at least 
one has a compile-time option to support 8-bit ints (though that goes 
against C standards, and is deprecated on current builds).  There are 
probably also targets with 64-bit ints.

So step one in asking for help here is to tell us your target.

Step two is to tell us what you are hoping to achieve.  Almost 
certainly, there is no way to change the int size - and even if there 
happens to be a command-line switch for the given target, it is probably 
not a good idea (you'll get in a horrible mess with library 
compatibility, for example).  And even if it is possible, it is highly 
unlikely to be advantageous.  Tell us what you really want to achieve 
here, and people can give you advice towards that.

mvh.,

David



More information about the Gcc-help mailing list