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

Re: FSFS/svn-rep-sharing-stats questions

From: Branko Cibej <brane_at_xbc.nu>
Date: Tue, 13 Oct 2009 16:04:34 +0200

Daniel Shahaf wrote:
> Branko Cibej wrote on Tue, 13 Oct 2009 at 04:39 +0200:
>
>> Daniel Shahaf wrote:
>>
>>> Was trying to avoid malloc'ing an unsigned int. But, indeed, I can't
>>> find a reference allowing the cast. So I have two options:
>>>
>>> * malloc an unsigned int
>>>
>>> * use pointer arithmetic:
>>> def increment():
>>> void *p = apr_hash_get();
>>> apr_hash_set(p+1)
>>> def extract_final_value():
>>> void *p = apr_hash_get();
>>> return (p - NULL)
>>>
>>>
>> Which is not strictly well-defined, either. :) void* doesn't have a
>> size, so you can't do arithmetic with it (never mind GCC's extension).
>>
>>
>
> First, we use sizeof(void *) in our code.
>

So we do. But as luck would have it, we don't use sizeof(void), which
your example code would require to be well-defined.

(And yes, my bad, I inadvertently wrote "void* doesn't have a size"
when it should've been "void doesn't have a size". Sorry.)

-- Brane

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2407102
Received on 2009-10-13 23:48:00 CEST

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