Bernd Zeimetz <[EMAIL PROTECTED]> 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 -- [EMAIL PROTECTED] 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/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]