Re: kern/subr_scanf array index of signed char

1999-01-28 Thread David O'Brien
> :Just curious.. why do you need the "(int)" cast? > > Actually, it could very well be that I don't. I didn't want to spend > the time to check to see if the compiler warned on unsigned-char array > indexes. When you add casts to quite warnings, please use the minium number of the

Re: kern/subr_scanf array index of signed char

1999-01-27 Thread Archie Cobbs
Matthew Dillon writes: > :>Actually, it could very well be that I don't. I didn't want to spend > :>the time to check to see if the compiler warned on unsigned-char array > :>indexes. You can change it back if unsigned char array indexes do not > :>produce a warning. > : > :Sloppy

Re: kern/subr_scanf array index of signed char

1999-01-27 Thread Matthew Dillon
:>Actually, it could very well be that I don't. I didn't want to spend :>the time to check to see if the compiler warned on unsigned-char array :>indexes. You can change it back if unsigned char array indexes do not :>produce a warning. : :Sloppy thinking. How would you know if y

Re: kern/subr_scanf array index of signed char

1999-01-27 Thread Bruce Evans
>:Matthew Dillon writes: >:> goto match_failure; >:> } else { >:> p0 = p = va_arg(ap, char *); >:> - while (ccltab[*inp]) { >:> + while (ccltab

Re: kern/subr_scanf array index of signed char

1999-01-27 Thread Alfred Perlstein
On Wed, 27 Jan 1999, Archie Cobbs wrote: > Alfred Perlstein writes: > > avoids a warning. > > No it doesn't. The "(unsigned char)" avoids the warning: > > $ cat > foo.c > int foo(int *array, unsigned char index) { return array[index]; } > $ gcc -c -Wall -o foo foo.c > $ doh' yes, it i

Re: kern/subr_scanf array index of signed char

1999-01-27 Thread Archie Cobbs
Alfred Perlstein writes: > > Matthew Dillon writes: > > > - while (ccltab[*inp]) { > > > + while (ccltab[(int)(unsigned char)*inp]) { > > > > Just curious.. why do you need the "(int)" cast? > > avoids a warning. No it doesn't. The "(un

Re: kern/subr_scanf array index of signed char

1999-01-27 Thread Matthew Dillon
::> - while (ccltab[*inp]) { ::> + while (ccltab[(int)(unsigned char)*inp]) { : :Actually, it could very well be that I don't. I didn't want to spend :the time to check to see if the compiler warned on unsigned-char array :in

Re: kern/subr_scanf array index of signed char

1999-01-27 Thread Alfred Perlstein
On Wed, 27 Jan 1999, Archie Cobbs wrote: > Matthew Dillon writes: > > - while (ccltab[*inp]) { > > + while (ccltab[(int)(unsigned char)*inp]) { > > Just curious.. why do you need the "(int)" cast? avoids a warning. -Alfred To Unsubsc

Re: kern/subr_scanf array index of signed char

1999-01-27 Thread Matthew Dillon
:Matthew Dillon writes: :> goto match_failure; :> } else { :> p0 = p = va_arg(ap, char *); :> - while (ccltab[*inp]) { :> + while (ccltab[(int

Re: kern/subr_scanf array index of signed char

1999-01-27 Thread Archie Cobbs
Matthew Dillon writes: > goto match_failure; > } else { > p0 = p = va_arg(ap, char *); > - while (ccltab[*inp]) { > + while (ccltab[(int)(unsig

kern/subr_scanf array index of signed char

1999-01-27 Thread Matthew Dillon
BZZZzzztt! Houston, we have a problem! Fixed. -Matt Matthew Dillon @@ -323,7 +323,7 @@ /* take only those things in the cl