I probably didn't state it very clearly, but that was what I was getting
at. It's the same value after a cast. As Andreas points out though, it
may not be bit-for-bit identical on machines that don't use two's
complement. That's why the conversion code cares about the format
specifiers, it seems.
> Now what does it mean to "convert the value to an unsigned and return
> that." This is the same as above, isn't it?
Explicitly, in the scan conversion you'd do a:
unsigned int *u = (unsigned int *) va_arg(args,long long *);
*u = (unsigned int) converted_value;
...from wherever you get converted_value from (simple_strtoul? I haven't
looked at that routine). (The cast here is implied if left off, I'm just
being explicit.)
> I.e., on the scanf() side, there is no conversion needed; just store the
> value.
Almost true, as Andreas pointed out. You have to be careful that the
target you're storing to has the correctly declared type inside the
conversion routine.
Ray
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/