C
clayne
I realize this may work for the majority of platforms. But I am
concerned about the aspects of sign extension and portability.
Is this portable:
{
unsigned long bw;
[...]
if ((signed long)(bw = read(s, buf, sizeof(buf))) == -1) {
error_handling();
}
}
With the goal being able to utilize larger unsigned values but still
being able to check for a return value of "-1" (since this is the
mechanism read() uses) to handle errors?
concerned about the aspects of sign extension and portability.
Is this portable:
{
unsigned long bw;
[...]
if ((signed long)(bw = read(s, buf, sizeof(buf))) == -1) {
error_handling();
}
}
With the goal being able to utilize larger unsigned values but still
being able to check for a return value of "-1" (since this is the
mechanism read() uses) to handle errors?