On Mon, 12 Dec 2005, Paul Eggert wrote: > "Joel E. Denny" <[EMAIL PROTECTED]> writes: > > > By the way, lint still gives some `implicit narrowing conversion' warnings > > for both yacc.c and glr.c. Have you seen them? > > Just for yacc.c. The GNU Coding standards say "Don't make the program > ugly to placate 'lint'" and I couldn't think of a way to placate lint > without uglifying the code greatly, so I ignored them.
I'm really just wondering about the narrowing itself. Was it intentional? For yacc.c, I get one warning. For glr.c, I get 6. They're all about assigning an int to a short int. Is the int for compatibility with yylex()? And the short int is an optimization? > The best idea I came up with was the following macro, but it's pretty > ugly.... > > /* Narrow VAL to TYPE. Lint complains about narrowing conversions > unless there is an explicit cast, so put one in. However, explicit > casts can mask other errors, so omit the cast in the non-lint case. */ > #ifdef lint > # define YYNARROW(type, val) ((type) (val)) > #else > # define YYNARROW(type, val) (val) > #endif I actually don't find that so ugly. It tells me that the narrowing is intentional. However, I fear my sense of ugly may be underdeveloped. Joel
