IDE: Code::Blocks 13.12
Compiler: GNU GCC
Language: C
Platforms: W7 and Linux Mint
Short version: On W7 I get sizeof(long) 4 bytes and on Linux Mint it is 8 bytes. I would like to have the same sizeof(long) on both platforms but cannot figure out how.
Longer version: I wrote a compiler and interpreter for a self defined language. The compiler - obviously - generates a code file that is read by the interpreter. I want to be platform independent with the compiled file. So, a file created with the Windows compiler must be readable by the Linux interpreter and vice versa. I can't get the compatibility to work. I noticed that in Windows, the sizeof(long)=4 and in Linux, sizeof(long)=8. As the compiler will write long integers to the output file I think the difference in size is (part of) the problems I have.
Is there a way I can change the sizeof(long) value?
I did search the forums for 'sizeof' and 'sizeof(long)' but with no luck. If I missed a post explaining this issue, I apologize and would appreciate a pointer.
Thanks for reading.