Function pointer casts in ANSI C

Evan Marshall Manning manning at nntp-server.caltech.edu
Wed Dec 5 06:08:18 AEST 1990


thorinn at skinfaxe.diku.dk (Lars Henrik Mathiesen) writes:
>My question is: Can a conforming compiler generate a warning for casts
>(and arguments) that will ``go wrong'' but not for those that work?

I wrote:
>My favorite lint (from Gimpel) would call those that work "non-portable",
>and issue a more serious warning/error message for those that not will
>work.

thorinn at skinfaxe.diku.dk (Lars Henrik Mathiesen) writes:
>Is this lint architecture- and compiler-specific (or configurable)
>since it knows what works? Or does it just guess based on two's
>complement, byte addressable, 32-bit int and pointer machines?

The Gimpel product I use is for PCs only, so it knows everything about
the processor architecture.  Various flags tell it sizeof int, data pointers,
and function pointers.  They're pretty good about providing flags for
everything reasonable so I'd bet there are one or two extra flags on
their more generic product.

***************************************************************************
Your eyes are weary from staring at the CRT for so | Evan M. Manning
long.  You feel sleepy.  Notice how restful it is  |      is
to watch the cursor blink.  Close your eyes.  The  |manning at gap.cco.caltech.edu
opinions stated above are yours.  You cannot       | manning at mars.jpl.nasa.gov
imagine why you ever felt otherwise.               | gleeper at tybalt.caltech.edu



More information about the Comp.lang.c mailing list