-
Notifications
You must be signed in to change notification settings - Fork 265
Description
In issue #1234, there was a complaint about the C output files Reko generates not being directly compileable. A contributing factor is that Reko is rendering internal PrimitiveType instances directly. These are not recognized by C compilers as valid code.
A possible solution is to have Reko emit types defined in <stdint.h>. Implementing it would result in:
PrimitiveType.Int32being rendered asint32_tin CPrimitiveType.Int16rendered asint16_tPrimitiveType.UInt64rendered asuint64_t
and so on.
However, there are some types that are not defined in <stdint.h>. There is no equivalent to PrimitiveType.Word32, for instance. Granted, uint32_t could be used to render Word32, but this would result in a surjection of multiple Reko PrimitiveTypes mapping onto the same <stdint.h> types. Perhaps Reko should supply a basictypes.h which contains:
typedef unsigned short int word16_t;
typedef unsigned int word32_t;
typedef unsigned long in word64_t;
typedef float float32_t;
typedef float float64_t;For platforms with 36-bit words, a basictypes32.h should be generated, containing:
typedef int int18_t;
typedef long int int36_t;
// etc