Re: Read hex string to a buf
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Wed, 31 Jan 2007 08:20:57 -0500
Christopher Layne wrote:
Keith Thompson wrote:.... snip ...
These casts (like most casts) are unnecessary. An array index
can be of any integer type.
$ cc -g3 -O3 -W -Wall -Werror -pedantic -o hex2dec hex2dec.c
cc1: warnings being treated as errors
hex2dec.c: In function 'main':
hex2dec.c:25: warning: array subscript has type 'char'
hex2dec.c:26: warning: array subscript has type 'char'
hex2dec.c:38: warning: array subscript has type 'char'
hex2dec.c:39: warning: array subscript has type 'char'
Yup. It's talking about set, and pointing out your error. Try
defining set as either signed or unsigned char. As usual, a cast
is probably an error.
(I haven't really looked at most of your program; a couple of
things just jumped out at me.)
Good ole comp.lang.c. Quick to point out any error. Care to add
anything else?
Yup. Wrong specification for printing an uncast size_t in your
printf statement. Here you have a real reason for using a cast, at
least in C90.
--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews
.
- Follow-Ups:
- Re: Read hex string to a buf
- From: Christopher Layne
- Re: Read hex string to a buf
- References:
- Read hex string to a buf
- From: cppbeginner
- Re: Read hex string to a buf
- From: Christopher Layne
- Re: Read hex string to a buf
- From: Keith Thompson
- Re: Read hex string to a buf
- From: Christopher Layne
- Read hex string to a buf
- Prev by Date: why it doesn't work?
- Next by Date: Re: why it doesn't work?
- Previous by thread: Re: Read hex string to a buf
- Next by thread: Re: Read hex string to a buf
- Index(es):
Relevant Pages
|