[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Clean code to be 64bit clean

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2003-12-01 00:03:57 CET

"Jay 'Whip' Grizzard" <elfchief@lupine.org> writes:

>> It's a bit off-topic, but the ISO C 99 stdint.h header optionally
>> provides intptr_t and uintptr_t. When these types are provided it is
>> guaranteed that a void* can be cast to a [u]intptr_t and then cast
>> back to the original void* value.
>
> I'm not familiar with the C99 spec (someone feel free to buy me a copy! ;),
> but from the names of the types, intptr_t (etc) seem to be integer pointers.

They are integer types, not pointers. The C99 standard, unlike the
C89 standard, is available at a reasonable price online from ANSI (I
suppose technically one is supposed to be in the USA to take advantage
of their service). You want ISO/IEC 9899:1999.

> The subversion code being talked about doesn't convert int pointers back
> and forth from (void *) -- it converts (int) back and forth from (void *).
>
> This is not, has not been, and never will be either legal, or a good
> thing to do.

Agreed. The correct solution is to apr_palloc a char/int/long, put
the value in the allocated memory, and store the address in the void*.
On the other hand, there is a long history of C programmers converting
integers to and from pointers and getting away with it.

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Dec 1 00:04:30 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.