by azakai · 13y ago · 0 comments
Consider C:
A C int can be 16 bits. Or 32. Or 64. Etc. As long constraints of the relation to the other types is met.
The moment the frontend specifies a primitive type for a field in the struct, that code is incompatible with a whole lot of platforms.
The fronted must choose which specific integer type that "int" in C maps to. At that point, the IR is no longer machine independent - if you pick 32 bit signed ints to represent C "int", your program will not match the C ABI on any platform using 16 bit unsigned int as C "int" and you won't be able to directly make calls to libraries on that platform, for example.
And once you generate that IR, you can't just built it to an arbitrary target, it must be the one it was generated for.
[EDIT: caf's post made it clearer. I know what you meant now]