You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using 64bit Nim with 32bit C nothing but confusion happens.
Description
For some reason or another using a 64bit Nim with 32bit GCC happens way too often. The error message it produces is very confusing. Nim should be able to error or generate the C code that errors (through #error directive) and explains what happens. Some thing like:
"Nim's 64bit mode used with C's 32bit mode. Please install the right compiler or pass the right flags."
It seems like everyone has run into this and always has been confused by it:
#19549 added error message to pointer size check assert and it was merged to Nim 2.0.
You can see how that error message looks like on console with following code:
{.emit: """#define NIM_INTBITS 123NIM_STATIC_ASSERT(sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8, "Pointer size mismatch between Nim and C/C++ backend. You probably need to setup the backend compiler for target CPU.");"""}
It seems like everyone has run into this and always has been confused by it:
These threads were created before Nim 2.0 and that NIM_STATIC_ASSERT didn't have error message in Nim 1.6.14 and older.
The C code can have an #error directive instead of the assert.
#error directive is a part of C preprocessor and it is used with #if branch.
But it cannot evaluate sizeof operator.
So following code result in compile error.
Summary
When using 64bit Nim with 32bit C nothing but confusion happens.
Description
For some reason or another using a 64bit Nim with 32bit GCC happens way too often. The error message it produces is very confusing. Nim should be able to error or generate the C code that errors (through #error directive) and explains what happens. Some thing like:
"Nim's 64bit mode used with C's 32bit mode. Please install the right compiler or pass the right flags."
It seems like everyone has run into this and always has been confused by it:
Alternatives
Examples
Output:
Backwards Compatibility
No response
Links
No response
The text was updated successfully, but these errors were encountered: