On Wed, 30 Oct 2002, Leopold Toetsch wrote: [sundry 'const' warnings]
> This warning WRT (void*) buffer was introduced for tcc, says the > comment. Can we put a > #ifdef __tcc__ / #endif around this - does tcc define something like this? Short answer: Yes, but it wouldn't really make any signficiant difference. (And I don't know the correct cpp #define to use as I don't have tcc installed anywhere and I didn't see such a #define in any of the on-line documentation, though I'd certainly imagine there is one.) Longer answer: I assume you're referring to this part of string.c: if (flags & BUFFER_external_FLAG) { /* The following cast discards the 'const'. That raises a warning with gcc, but is ok since the caller indicated it was safe by setting BUFFER_external_FLAG. (The cast is necessary to pacify TenDRA's tcc.) */ s->bufstart = (void *) buffer; If you remove the cast, you still get a warning from gcc (and possibly other compilers) since you are still trying to discard the 'const'. So removing the cast only has the effect of causing tcc to refuse to build string.c. Nicholas Clark suggested that we could perhaps use a union, something like union { const void *const_ptr; void *nonconst_ptr; } ptr; /* ... */ if (flags & BUFFER_external_FLAG) { ptr.const_ptr = buffer; s->bufstart = ptr.nonconst_ptr; s->buflen = buflen; } This should get rid of all warnings. I haven't checked whether the optimizer optimizes away the extra assignment or not. If it does, then this union trick may be the way to go. Volunteers to check it out would be welcome. -- Andy Dougherty [EMAIL PROTECTED]