V
viza
unsigned int number;
scan=sscanf(" -76","%u",&number);
printf("number has the value %d as %%d and %u as %%u.\n",number,number);
under gcc/3.2.2* this is returning 1, and assigning a value to number.
Isn't this wrong?
My reading of the man pages is that a '-' is not allowed. Doesn't this mean
it should be impossible to make the conversion, scanf should return 0 and
number should be left alone - just like if another non allowed character
were there, (eg: a letter)?
What have I missed?
* gcc (GCC) 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk)
scan=sscanf(" -76","%u",&number);
printf("number has the value %d as %%d and %u as %%u.\n",number,number);
under gcc/3.2.2* this is returning 1, and assigning a value to number.
Isn't this wrong?
My reading of the man pages is that a '-' is not allowed. Doesn't this mean
it should be impossible to make the conversion, scanf should return 0 and
number should be left alone - just like if another non allowed character
were there, (eg: a letter)?
What have I missed?
* gcc (GCC) 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk)