0

Is there any c macro predefined if compiler option -mint8 is in use?

Background:

I can compile something for avr with the -mint8 compiler option which results in smaller code size. That violates against the c standard, but this is not the problem here.

I simply want to

#ifdef MINT8  // search the name for the macro here
  ...
#endif
Klaus
  • 24,205
  • 7
  • 58
  • 113
  • Is there a reason why `int_least8_t` or `int_fast8_t` isn't being used instead? – Ignacio Vazquez-Abrams Nov 11 '15 at 18:31
  • Sometimes you can not control which type is used "internally". E.g. bit fields will generated as int internally. Access of bit fields will result without -mint8 in 2 byte access which is much overhead sometimes. – Klaus Nov 12 '15 at 10:09

1 Answers1

3

AVR Libc tests the value of __INT_MAX__:

#if __INT_MAX__ == 127
 ...
#endif

If you include <stdint.h> then it will define __USING_MINT8 as 0 or 1 as appropriate.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358