Size of primitive built-in types?

Hi there,

I need to know the size of the following types under AT89S8253 (an 8051 derivative):

sizeof(short) = ?

sizeof(unsigned long) = ?

sizeof(float) = ?

Best regards

As with the AVR chip that you asked about on another forum, this too is an 8 bit micro, and the question goes to the choice of compiler and compiler configuration options, not the chip.

Is this a homework assignment?

Compile this code for your target and run it:

#include <stdio.h>

int main(void)
{
  printf("sizeof(short)=%d\n", sizeof(short));
  printf("sizeof(unsigned long)=%d\n", sizeof(unsigned long));
  printf("sizeof(float)=%d\n", sizeof(float));

  while (1);
  return 0;
}

:stuck_out_tongue:

Thank you very much for the answer - I compiled a program that finds out the sizes of these types - it worked for me.

I am using Keil uVision IDE.

Yes, it is like a homework assignment :wink: