[Freeciv-Dev] Re: int -> void*, was Re: [RFC] Attaching information to o
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Thu, 18 Jan 2001, hawk@xxxxxxxxxxxxxxxxxxxxxxx wrote:
> On Wed, Jan 17, 2001 at 07:11:00PM -0800, David Pfitzner wrote:
>> Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
>>
>> > On Mon, Jan 15, 2001 at 03:11:08PM -0800, David Pfitzner wrote:
>>
>> > > Is it guaranteed by the language that stuffing the int into the
>> > > void* will always work, or does it just happen to work on most
>> > > (all?) platforms?
>>
>> > ISO/ANSI C99 added optional types intptr_t and
>> > uintptr_t. Pointers can be cast to these types and back without
>> > loss of information. IMHO they are expected to be used in weird
>> > places where pointers need to be stored together with integers
>>
>> Well, I don't think Freeciv actually uses/requires C99 features
>> at this time :-)
>
> Configure can maybe teached to recgonize that intptr_t is available.
Isn't this what unions are for? eg.
typedef union {
int i;
void *p;
} my_inptr_t;
--
Big Gaute http://www.srcf.ucam.org/~gs234/
Uh-oh -- WHY am I suddenly thinking of a VENERABLE religious leader
frolicking on a FORT LAUDERDALE weekend?
|
|