httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gregory A Lundberg <>
Subject Re: warnings on Solaris
Date Sat, 17 Jan 1998 15:37:15 GMT
On Sat, 17 Jan 1998, Ben Laurie wrote:

> This is the same as const x **. Did you mean something like const x
> const ** (or do I mean const x * const *?)?

I always find parenthesis good at this point.  If you mean a pointer,
which I cannot change, to a pointer which I can change, try:
  const (x *) *    or    x * const *
I think the first is more correct, but on some compilers I've had trouble
with it and found they wanted the second form.  Since we're worried about
portability, I'd suggest clarifying the issue with some typedefs.

typedef const int cint;         /* const int */
typedef cint * cintptr;         /* var ptr to const int */
typedef const cintptr cintcptr; /* const ptr to const int */
cintcptr * x ;                  /* var ptr to const ptr to const int */
const cintcptr * y;             /* const ptr to const ptr to const int */

Unrolling this yields
  const const int * * x;
  const const const int * * y;
which _should_ work but confuses some compilers (and most programmers) so
let's stick with typedefs.

While casts are Bad Things, typedefs are Good Things.  They are so good
that with some lints you can have them treated as completely new types and
get warnings about assigning a squarepeg to a roundhole even though both
are typedef'd void* underneath.  Betcha if Apache used 'em everywhere the
warnings list from the nightly builds 'd fill a filesystem :P


Gregory A Lundberg		Senior Partner, VRnet Company
1441 Elmdale Drive              email: []
Kettering, OH 45409-1615 USA    voice: +1 (937) 299-7653

View raw message