C Standard Library oddity
1
Name:
Anonymous
2008-06-25 9:12
int fputc(int c, FILE *stream);
So why does fputc take an integer when it writes an unsigned char?
Believe it or not, I actually had a fucked up program because of this and it took so long to get it right because I couldn't understand what was wrong.
3
Name:
Anonymous
2008-06-25 9:44
It's for type compatibility with getchar , which returns an int rather than unsigned char so it can include negative numbers for exceptions like EOF.
4
Name:
Anonymous
2008-06-25 9:46
Compatibility with getc , I mean.
7
Name:
Anonymous
2008-06-25 10:40
,'``.._ ,'``.
:,--._:)\,:,._,.:
:`~-,'' :`.~.';\ HAVE YOU READ
`,' `---' `. YOUR SICP TODAY?
/ :
/ \
,' :\.___,-.
`...,---'``````-..._ |: \
( ) ;: ) \ _,-.
`. ( // `' \
: `.// ) ) , ;
,-|`. _,'/ ) ) ,' ,'
( :`.`-..____..=:.-': . _,' ,'
`,'\ ``--....-)=' `._, \ ,') _ '``._
_.-/ _ `. (_) / )' ; / \ \`-.'
`--( `-:`. `' ___..' _,-' |/ `.)
`-. `.`.``-----``--, .'
|/`.\`' ,',');
9
Name:
Anonymous
2008-06-25 11:01
.
@
@ \ ,
/ ,'``.._ ,'``.
\ . :,--._:)\,:,._,.:
, , :`~-,'' :`.~.';\
'-._ ___.....___ / `,' `---' `.
`.__ ,-' \-/`-, / :
`''-------' ( @ ) `._ / \
>-> \ ,' :\.___,-.
\ `...,---'``````-..._ |: \
. \ ( ) ;: ) \ _,-.
\---..,--' `. ( // `' \
................._ \,'..--, : `.// ) ) , ;
`-.._ ||_.-' ,-|`. _,'/ ) ) ,' ,'
`'-----'' ( :`.`-..____..=:.-': . _,' ,'
|| `,'\ ``--....-)=' `._, \ ,') _ '``._
|| _.-/ _ `. (_) / )' ; / \ \`-.'
/\ `--( `-:`. `' ___..' _,-' |/ `.)
`-. `.`.``-----``--, .'
|/`.\`' ,',');
10
Name:
Anonymous
2008-06-25 15:24
12
Name:
Anonymous
2008-06-26 7:33
Newer Posts