[futurebasic] Re: [FB] Pointer From An Integer Without A Cast

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2011 : Group Archive : Group : All Groups

From: Brian S <fblistserve@...>
Date: Fri, 28 Jan 2011 08:43:00 -0700
On Jan 27, 2011, at 3:20 PM, Robert Purves wrote:

> 
> Max Taylor wrote:
> 
>> This has bugged me for some time but has never caused a problem but always a warning from "gcc".
>> 
>> It appears to me that the code in the function call to GetMethodAddress in the C code below may not be passing the proper type of pointer because it says that it is trying to make a pointer from and integer without a cast. 
>> 
>> Is, *(long*)self, not a pointer? “self” is defined as a pointer type that points to a data structure that is an Object to begin with but what I need is the “ClassRecordPtr” that is contained in the first field [0] of what “self” points to. That first field of ‘self’ is a pointer type that contains the “ClassRecPtr” to the dispatch record for the class of Object that ‘self’ points to and that is what I mean to pass to “MxGetMethodAddress”. I thought that is what I was getting here but I get the gcc warning every time.
> 
> *(long*)self is a long.
> *(void*)self is a generic pointer.

To elaborate just a tad, a generic pointer means untyped which in FB means var defined “as pointer” 
The parenthesis cast the var to the type specified ---in this case a pointer to a long


Brian S