[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More problems on HP-UX ... 6

From: Andreas Vögele
Subject: Re: More problems on HP-UX ... 6
Date: Wed, 28 Apr 2004 09:09:02 +0200

Kevin Ryde writes:

According to my copy of "Programming in C" it should be okay to
pass a char instead of an int to iscntrl() etc.

I think it was meant to be an int.  But if you're in 7-bit ascii then
it doesn't make a difference.

Yes, but my German copy of "Programming in C, 2nd ed" says in section A.6.1: "A character [...] can be used everywhere in an expression where an integer object is required. [...]". And according to section A.7.3, subscript array references are expressions.

backtrace.c: In function `display_frame_expr':
backtrace.c:403: warning: subscript has type `char'

numbers.c: In function `mem2uinteger':
numbers.c:2337: warning: subscript has type `char'

Thanks, I'll add some casts to "int".  They definitely want casts
through "unsigned char", to protect against 8-bit values.

When I googled for the "subscripts has type char" problem I found a statement that says that casts to "int" could "cause problems" on other systems. Whatever that means.

Since the build only aborts if --enable-maintainer-mode, i.e. -Werror, is enabled I'd probably keep the "char" values. BTW, I use only one cast to fix this problem (in backtrace.c). In numbers.c I changed the type of the variables to "int".

reply via email to

[Prev in Thread] Current Thread [Next in Thread]