[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Meaning of methodReturnType values ?
From: |
Richard Frith-Macdonald |
Subject: |
Re: Meaning of methodReturnType values ? |
Date: |
Fri, 15 Jun 2001 14:54:16 +0100 |
On Friday, June 15, 2001, at 02:26 PM, Laurent Julliard wrote:
I'm playing with the GNUstep NSMethodSignature class. One of the method
available in there is methodReturnType which is supposed to tell you
about the type of the value returned by a method.
Problem is: I couldn't find an include file where the meaning of the
value returned by this method is explained. Actually it is supposed to
return a string. I can print the string ok (look like "@8@4@:" for
instance but I'm unable to make sense of it.
Avi Bryant was kind enough to direct me to the ADC (Apple Developers
Connection) site where there is some information about that but it
doesn't seem to apply to GNUstep based on what I have observed so far.
(see
http://developer.apple.com/techpubs/macosx/Cocoa/Reference/Foundation/ObjC_classic/
TypesAndConstants/FoundationTypesConstants.html
and look for "ObjC Types" in the document)
Any help/pointer or code samples would be really appreciated.
This stuff is defined by the compiler/runtime ... see onjc/objc-api.h
The NeXT/Apple book 'object oriented programming and the objective-c
language' has a section on type encodings
(you can find various links to versions of this from the gnustep
website).
Basically, for most purposes, ignore the numbers (they are for stack
frame or register offsets and vary from machine to machine).
an '@' denotes an object,
an ':' denotes a selector
an 'i' is an integer
an 'I' is an unsigned integer
etc
Your example '@8@4@:' is a method returning an object, with two (hidden)
arguments, the receiver, and the selector.
All methods will have a "@' and ':' for those two hidden arguments.
So '- (int) promote: (short)s;' would produce a type encoding string of
'i@:s'