On Wednesday 26 September 2007 01:16:54 [EMAIL PROTECTED] wrote:

> Author: paultcochrane
> Date: Wed Sep 26 01:16:53 2007
> New Revision: 21597
>
> Modified:
>    trunk/languages/m4/src/eval.c
>
> Log:
> [m4] Cast isxxx() function arguments explicitly to unsigned char as per
> coding standards.

I don't understand this patch.  *eval_text is explicitly defined in that file 
as an unsigned char *.  Why cast it?  At best, a smart compiler will see that 
it's unnecessary and ignore it.  At worse, it'll confuse readers who think 
that the code may be doing the wrong thing.  (An explicit cast is probably 
*dangerous* if the type of the argument is wrong, as it'll likely have 
signedness problems and we won't even get a compiler warning.)

I've read the paragraph talking about this in PDD 07 and I don't see anything 
that requires an explicit cast when the type is appropriate.  I interpret the 
rule as saying "If you pass in a signed number, you're doing it wrong, so 
don't ever do that; it's a source of bugs."

-- c

Reply via email to