relation between sizeof(void*), sizeof(int) 
Author Message
 relation between sizeof(void*), sizeof(int)

On 25 Jul 2001 14:32:15 GMT, Harald Kirsch


>> > Because array A does not contain the nodes themselves but rather
>> > pointers to the nodes.  Consequently, an edge leaving from node i
>> > would be A[i]->p.

>> That would make sense, if you didn't add:

>> > And for exactly one j we have A[i]->p==A[j].

>> Now I don't get it.  I take it you are going to write A[i]->p, but that
>> still is *some* member of the A array, right?  So you can subtract A
>> from it and get an integer, and add A back to get the pointer you
>> wrote.

>> > When serializing node *(A[i]) I need to know j in order to write it
>> > out instead of the pointer.

>> A[j] == A + j, so if A[i]->p == A[j], then j == A[i]->p - A.

>Hmm, I thought that in contrast rather

>  &(A[j])==A+j and A[j]==*(A+j)

>holds for rvalues in general.

But if you want to convert pointers to indices, you need to use
lvalues, and that is the more common and general form of
expression used, from which the rvalue expressions can be

Thanks. Take care, Brian Inglis         Calgary, Alberta, Canada

    fake address                use address above to reply

                                                spam traps

Thu, 15 Jan 2004 00:12:25 GMT  
 [ 16 post ]  Go to page: [1] [2]

 Relevant Pages 

Powered by phpBB® Forum Software