Compilation Warning on inet-1.99.4 32/64 bit compat of MACAddress.h

40 views
Skip to first unread message

EZ

unread,
Jun 4, 2012, 3:46:37 AM6/4/12
to omn...@googlegroups.com
Hi

I have just moved to inet-1.99.4-development-03d5d15-src.tgz
I am running on Ubuntu i686:
2.6.35-32-generic #67-Ubuntu SMP Mon Mar 5 19:35:26 UTC 2012 i686 GNU/Linux

I get the warnings:
linklayer/contract/MACAddress.h:59: warning: integer constant is too large for ‘unsigned long’ type
linklayer/contract/MACAddress.h:119: warning: integer constant is too large for ‘unsigned long’ type
linklayer/contract/MACAddress.h:124: warning: integer constant is too large for ‘unsigned long’ type

It is clearly caused by the fact long int on my machine is 32bit...

AFAIK there is no "standard" way to write portable code that will know if the long int is 64bit or 32bit.
So I am not sure what to propose here. 
I think a best fix should go into OMNET configure script itself (could be coded as a simple test 
program that checks the sizeof(long int)). That would probably add -DIS64BIT or similar.

Meanwhile (for linux) we can simply add the following code to linklayer/contract/MACAddress.h:
#if defined(_WORDSIZE) && __WORDSIZE == 64 
#   define MAC_ADDRESS_MASK 0x0000ffffffffffffUL
#else
#   define MAC_ADDRESS_MASK 0x0000ffffffffffffULL
#endif
Reply all
Reply to author
Forward
0 new messages