MISRA typedef.

22 Jan 2010

Dear all,

I notice when I include the code for defining types (see below) I get the error message

""uint32_t" has already been declared in the current scope (E101)" in file "temp100/misra_types.h"

I have recently upgraded from library version 9 to lbrary version 19 and the problem was not vissible before. I presume the new library has defined in it somewhere the typedef relating to uint32_t

Can you suggest a work around? What other types have been defined and where can i find them.

 

Best Regards

David Giles


/* Bytes (8bit length) */
typedef unsigned char uint8_t;
typedef char sint8_t;

/* Half Words (16bit lengths) */
typedef unsigned short uint16_t;
typedef short sint16_t;

/* Words (32bit lengths) */
/* Also int */
typedef unsigned long uint32_t;
typedef long sint32_t;

/* Double Words */
/* Also long long and long double */
typedef unsigned long long uint64_t;
typedef long long sint64_t;

22 Jan 2010 . Edited: 22 Jan 2010

Hi David,

David Giles wrote:
notice when I include the code for defining types (see below) I get the error message ""uint32_t" has already been declared in the current scope (E101)" in file "temp100/misra_types.h"

These are standard fixed width types defined in stdint.h, which is provided as part of the ARM compiler library. They get used (and therefore pulled in) by the mbed libraries.

You shouldn't need to redefine them (they were introduced as part of the C99 std), so where you do want to use them, just #include <stdint.h>.

Simon