This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 16-bit int



Ian Lance Taylor wrote:
On Thu, Aug 9, 2012 at 3:38 PM, Vincent Lefevre <vincent+gcc@vinc17.org> wrote:

There are many processors I don't know. What I'm interested in is information like: is there any target that has some given int type size?

In the GCC source code:


grep INT_TYPE_SIZE gcc/config/*/*.h

There are also a number of out-of-tree gcc ports.

Similar information on them would be interesting too.

Pretty hard to come by, though. Many out-of-tree ports are out-of-tree for a reason.


Usually, a regular compiler user just needs to know the size of int on the particular architecture he's working on, not on every processor/OS existing on the wild. So, the simpler is just to run a program like :

#include <stdio.h>
int main()
{
  printf("sizeof int = %d\n", sizeof(int));
}


If someone needs, for some valid reason, that the integer variables be 16-bit wide, the good practice to write clean, portable and maintainable code is to use "int16_t" integer type instead of just "int".


JM

--

 Envoyé de ma machine à écrire.
 ---------------------------------------------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]