From vograno at evafunds.com  Wed Mar 16 00:30:11 2005
From: vograno at evafunds.com (Vadim Ogranovich)
Date: Wed Mar 16 00:30:22 2005
Subject: [Rd] How to store void* on 64 bit machines
Message-ID: <C698D707214E6F4AB39AB7096C3DE5A58FF422@phost015.EVAFUNDS.intermedia.net>

Hi,
 
I have an R class which represents a file stream (this is my custom
implementation of R I/O and has nothing to do with the standard R
connections). The class has a slot, called id, which is essentially a
void* pointer to a C++ stream object.
 
Up until now I worked on 32-bit machines and the id slot was an integer,
so one could cast back and forth between int and void*. However, on
64-bits void* is castable to 'long int', but not int, which poses a
couple of problems:
a) since there is no R arrays of 'long int' type what other built-in
type can I use to store void*. For example double is big enough to
accommodate void*, but I am not sure whether casting will work both
ways.
b) assuming that a) is solvable, is there a solution which is portable
between 64 and 32 bit machines?
 
Thanks,
Vadim

	[[alternative HTML version deleted]]


[Rd] How to store void* on 64 bit machines
Vadim Ogranovich