Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 64 bit addressing



But what will somebody have done when they got that warning? The point is they would have changed the return statement to this to shut up the compiler:

return (void *)(int)x;


Maybe they should have reviewed their code not only for portability, but for functionality too ;-)

I've worked/studied a few on an IBM 64 bits server (AIX 5/POWER4's), and I like their c compiler (gcc's too inefficient for 64 bits xcoff executable) that give such simple portability warnings (int->void*):

"test.c", line 4.8: 1506-745 (I) 64-bit portability: possible incorrect pointer through conversion of int type into pointer.

If you don't want them (eg. your project's target is only a 32 bits executable), you just omit the -qwarn64 flag. I agree it's better to have separated 64 bits portability warnings, which could be enabled even when compiling in 32 bits mode (very important). The size conversion issues are specific to an architecture and are unuseful for 64 bits portability (it wouldn't detect int->void* in 32 bits mode).

Additionally, and funny thing, AIX's cc doesn't give a _64 bits portability warning_ for the previous 'void *foo(unsigned short x)' example, unsigned short (sizeof=2) is too far from void* (sizeof=8), so it's not really a 64 bits issue.

Still in my AIX case, sizeof(int) is 4 so a warning for int->void* is worth looking at. Finally, such a system can have libraries for both code [addressing] modes, eg. liblapack_pwr4_32.a and liblapack_pwr4_64.a (same for .so). They are all mixed in /usr/lib, but I'm sure the Frameworks's design could be a neat way to arrange most of them on OS X.. *thinking aloud* :-)


Regards,

Stephane Thiell
Student, Master d'Informatique
University of Bordeaux I, France
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: 64 bit addressing (From: "Timothy J. Wood" <email@hidden>)
 >Re: 64 bit addressing (From: Chris Kane <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.