[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: RFS: ustr (updated package)



Bernd Zeimetz <bernd@bzed.de> writes:

> James Antill wrote:
>>  That code is basically:
>> 
>> extern inline size_t ustr_xi__pow2(int use_big, unsigned char len)
>> {
>>   static const unsigned char map_big_pow2[4] = {2, 4, 8, 16};
>>   static const unsigned char map_pow2[4] = {0, 1, 2,  4};
>> 
>> ...so I'm pretty sure it's correct as is, and the version of GCC
>> used is giving out false warnings.
>
> I doubt that.
> http://gcc.gnu.org/ml/gcc-patches/2006-05/msg00182.html

 From the above email:

  This patch makes GCC's inline function support more like the C99
  support.  To be precise, it implements 6.7.4 paragraph 3

ISO 9899:1999, 6.7.4 paragraph 3 says:

  An inline definition of a function with external linkage shall not
  contain a definition of a modifiable object with static storage
  duration, and shall not contain a reference to an identifier with
  internal linkage.

...as both of the declarations are "static const", 6.7.4#3 doesn't
apply.

-- 
James Antill -- james@and.org
C String APIs use too much memory? ustr: length, ref count, size and
read-only/fixed. Ave. 44% overhead over strdup(), for 0-20B strings
http://www.and.org/ustr/



Reply to: