3 ms·
Ah, implicit type conversions being a footgun yet again. int fgetc( FILE *stream ); But the retval is treated as a char.
by dleslie 3y ago
Ah, implicit type conversions being a footgun yet again.
int fgetc( FILE *stream );
But the retval is treated as a char.
- kevin_thibedeau 3y agoThe retval is an int. It only gets treated as a char if it isn't EOF. The caller is supposed to know this and do the right thing rather than blindly downcasting. This is more apparent with the wide char library where there is a special wint_t with the sole purpose of serving as a return value that represents a wchar_t or WEOF.