On Dec 14, 2007, at 11:15 PM, Bob Delaney wrote: > I found the problem. Xcode C++ treats 'long int' as a 32 bit number. > This code: > > cout << "sizeof(long) = " << sizeof(long) << endl; > cout << "sizeof(int) = " << sizeof(int) << endl; > cout << "sizeof(long long) = " << sizeof(long long) << endl; > cout << "sizeof(long int) = " << sizeof(long int) << endl; > > gives the output: > > sizeof(long) = 4 > sizeof(int) = 4 > sizeof(long long) = 8 > sizeof(long int) = 4 > > So long is 4 bytes or 32 bits, int is 32 bits, long long is 64 bits, > but long int is only 32 bits! What a terrible trap for any programmer!
This is why I'm a big fan of types named Int8, Int16, Int32, Int64, Int196, or whatever rather than Short, Int, Long. Much less confusion. I'm a big fan of as much less confusion as possible. (But I'm easily confusable.) Kirk ----------------------------------------------- REALbasic Professional 2007r5 MacBook Core 2 Duo, Mac OS X 10.5.1 Power Mac dual G4, Mac OS X 10.4.11 _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
