johns@macondo.Caltech.Edu (John Salmon) (02/26/89)
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@wega.caltech.edu
henry@utzoo.uucp (Henry Spencer) (02/28/89)
In article <9772@cit-vax.Caltech.Edu> johns@wega.caltech.edu (John Salmon) writes: >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... The wording on this has changed considerably, with problems like that in mind. >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... You're mistaking people with broken compilers for a change in the standard. Unknown identifiers still evaluate to 0. The problem is that K&R1 wasn't explicit about this and so some compilers object; they will have to be fixed. -- The Earth is our mother; | Henry Spencer at U of Toronto Zoology our nine months are up. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu