Peter N Lewis wrote:
At 12:36 +0200 1/7/05, Frank Heckenbach wrote:
Lack of univ parameter support (I see Sun Workshop Compiler docs
So what do you really need?
Every use of univ in the Apple Universal Interfaces is a pointer (they are all just Ptr, but that is unsurprising since they don't specify the implementation anyway, and they are probably defined as void * in the C interfaces).
In my own code, I have roughly 500 odd uses, including:
Ptr PtrPtr
MyListHeadPtr MyListItemPtr DCtlArrayPtr FSXParamBlockRecPtr BookmarksBarItemPtr MovableModalStatePtr MyQElemPtr ParmBlkPtr QElemPtr CFPropertyListRef CFTypeRef
UInt32 SInt32 SInt16 UInt16 SInt64 UInt64
The use breaks down as:
- General arbitrary memory pointer (eg for BlockMove, FileWriteData, etc)
- Pointers to polymorphic type (eg CFPropertyListRef is a "subclass"
of CFTypeRef, and shares functions like Destroy, Show, etc).
- Pointers to extendable types (eg MyQElemPtr points to a record that
must start with a QElemRecord, but then continues with user data).
- Storage/Retrieval of user data (eg, user data is 32 bits, and can
store an arbitrary user data like a reference number or pointer).
- Low level data manipulation (like read/write 16/32/64 bit
quantities from a file).
So basically Pointer and sized integer are the uses I have, and the sized integer that matches the size of pointer needs to be compatible. Also, ideally, it would be compatible with function pointer as well, since that would be one thing that might want to be stored in a userdata field.
I think so. We have some problems with function pointers. Another thread a while ago pointed me to them, but they seem difficult to fix, and I haven't done this yet. (In that thread, AFAIR, Waldek fixed the problem at hand, and also noted the deeper problems.) So this should happen sooner or later (I hope sooner ;-).
Anyway, if I get this right, the vast majority of your uses, are actually pointers/references, including all in Apple's headers.
BTW, the mentioning of C interfaces is a good point. AFAIK, `void *' is the closest thing you can do in C anyway, and there is no parameter that accepts either pointers or integers (barring completely undeclared functions and varargs which have no checking at all, of course). So I could ask heretically, do we want even looser type checking than C? ;-)
Seriously, I'd really prefer to go for the "acceptably happy" solution (referring to your other mail), in particular if it does not even impede the Apple interfaces (which you can't change at will, I understand).
Frank