You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Mike Duigou <ap...@duigou.org> on 2006/07/11 18:10:51 UTC

Re: apr_uint8_t and apr_int8_t?

I'm still interested in seeing this patch committed. Any volunteers or 
objections?

Mike

Mike Duigou wrote:
> Martin Sebor wrote:
>> Mike Duigou wrote:
>>> A patch to add apr_uint8_t and apr_int8_t to apr.h is attached. It 
>>> also ensures that CHAR_BIT is 8 bits (it normally is) and that 
>>> short_value and long_value are defined.
>>
>> I normally just lurk here but this issue has caught my attention
>> as I recently implemented the same thing in C++ and gained some
>> insight into the gotchas behind these seemingly trivial typedefs.
>> I hope you'll find it helpful.
>>
>> First, char may be an unsigned type so apr_int8_t should be an
>> alias for signed char in that case.
> 
> Very good point. I've updated my patch to correct this.
> 
>> Second, if APR headers are intended to be used in C++ programs
>> (I don't know if that's possible or desirable), it would be a
>> good idea to define apr_int8_t to the same type as int8_t in
>> <stdint.h> and not simply to signed char unconditionally. Doing
>> otherwise will prevent the two from being interchangeable and
>> lead to compilation or linker errors in programs that mix and
>> match them.
> 
> I've also updated the patch to use int8_t or uint8_t from <stdint.h> 
> rather than "signed char" and "unsigned char" when stdint.h is available.
> 
> Thanks for the feedback! The updated patch is enclosed.
> 
> Mike
> 


Re: apr_uint8_t and apr_int8_t?

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 7/11/06, Mike Duigou <ap...@duigou.org> wrote:
> I'm still interested in seeing this patch committed. Any volunteers or
> objections?

I don't have time to look at this now, but if you file a bug it's less
likely to get totally forgotten...

-garrett