Re: error: parse error before numeric constant

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Tue, 18 Nov 2003 18:40:58 +0100 (CET)

On Tue, 18 Nov 2003, Andres Kroonmaa wrote:

> > > - if (isupper(*s1))
> > > + if (isupper((int)(char)*s1))
> >
> > This cast it not correct. The input to isupper and any other ctype
> > functions should be a unsigned char manually or implicitly casted to int..
>
> is it harmful? I thought, if I cast just (int)*s1 then it might take
> 4 bytes from *s1 instead of 1. If I cast just (char), then the warning
> remains valid.

It it harmful, but not for the reasons you worry about. The cast hides the
problem instead of correcting it.

> anyway, what would be correct cast here?

(int)(unsigned char)

alternatively s1 is changed to a unsigned char * type and the cast is
just (int).

> > > ../../HEAD3/snmplib/mib.c: In function `lc_cmp':
> > > ../../HEAD3/snmplib/mib.c:130: warning: subscript has type `char'
> >
> > Valid varning.. the source type of the index should most likely be an
> > unsigned char..
>
> I'm not sure why gcc or squid compile script considered this as fatal..

Probably because of -Werror...

> > If you compile without --enable-esi Squid won't define ESI, but if your
> > system headers pollute the namespace with a ESI define then you are
> > screwed and all references to ESI within Squid needs to be replaced by
> > another define or again someone at Sun needs some bashing..
>
> Well, what path we should take? ;)

Both.

Work around the problem in Squid and yell at the OS provider for providing
such crappy software.

Unforunately I have to leave the yelling part to you as it is a little
hard to get thru to most vendors if you do not have a support contract or
don't even use their stuff..

Regards
Henrik
Received on Tue Nov 18 2003 - 10:41:03 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:20:47 MST