This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: set SHORT_TYPE_SIZE to 8
- From: David Brown <david at westcontrol dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 23 Nov 2015 16:35:21 +0100
- Subject: Re: set SHORT_TYPE_SIZE to 8
- Authentication-results: sourceware.org; auth=none
- References: <1448280992521-1208654 dot post at n5 dot nabble dot com> <CAH6eHdR0_OkSVsHy2_rMiQ+zEm=yTgWWM6LPUvV9O6t0trJ=fA at mail dot gmail dot com> <1448282702293-1208677 dot post at n5 dot nabble dot com>
On 23/11/15 13:45, htio2 wrote:
> but avr is setting its short and int to 8 bit ....
>
The AVR is an 8-bit cpu, but "int" on the AVR is 16-bit (as is "short").
There is an option "-mint8" to make "int" and "short" 8-bit on the AVR,
but it is not supported by the libraries and I believe has been
deprecated in the compiler itself.
Even if the cpu you are porting to is 8-bit, keep short and int at
16-bit. That is the minimum required for standard C, and no one will
thank you for making a non-standard C port. Of course, you should make
heavy use of uint8_t and int8_t in library codes and any other support
code if it is an 8-bit target, but keep short and int standard.