On Mon, Jun 2, 2008 at 12:47 PM, Dr. Stephen Henson <[EMAIL PROTECTED]> wrote: > On Sun, Jun 01, 2008, Ben Laurie wrote:
>>> Stop const mismatch warning. >>> - else if (index_name_cmp(row,rrow)) >>> + else if (index_name_cmp((const CSTRING *)row,(const CSTRING *)rrow)) >> I do wish you'd find ways to fix these that don't involve casts! > Well I'm open to suggestions on this one... > > It's a "feature" of C that if you do... > > const something * const *foo; > something **bar; > > foo = bar; > > you get a warning about different const types. This bit in the ASN1 code where > what used to be: > > char **p; > > was changed to the more correct: > > const char * const *p; > > and produces warnings in code which uses the previous form. You can create a type-safe macro that does the cast for you -- see examples in Ben's recent code. An expression such as (1 ? (p) : (char **)NULL) in the macro's definition should ensure that using the macro will cause a warning if p isn't of the intended type. So just cast an expression like this to the properly constified type, within the macro. Then the cast is just in the macro definition where it can be more easily verified, rather than having casts directly in the code. Bodo ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [email protected] Automated List Manager [EMAIL PROTECTED]
