a scanf question and a preprocessor question

John Salmon johns at macondo.Caltech.Edu
Sun Feb 26 07:42:51 AEST 1989


1)
In section 4.9.6.2, the fscanf function:
I have a very old version of the standard which says the the 
argument corresponding to a %x directive should be an int, and that
the conversion is performed according to the rules for strtol.
If this is true, then there is no way to convert hex constants between
LONG_MAX and ULONG_MAX, i.e. on a 32-bit machine:
unsigned long int ui;
sscanf("0x80000000", "%lx", &ui);
would result in errno set to ERANGE and a matching failure.

Is this still the case??  Is there an approved way to convert unsigned
hex values with the high bit set??

2)
In section 3.8.1 Conditional Inclusion, paragraph 2: Semantics:
...During this evaluation, each identifier not currently defined
as a macro evaluates to 0...

I am told that this is no longer the case, and that undefined symbols
in #if pre-processor constant expressions are in error.  What is the current
relevant passage on this subject?

Thanks,
John Salmon
johns at wega.caltech.edu



More information about the Comp.std.c mailing list