🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #5740

a scanf question and a preprocessor question

#5740
From: John Salmon
Date: Sat, 25 Feb 1989 21:42
27 lines
1432 bytes
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
Technical Details
Message-ID: <9772@cit-vax.Caltech.Edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!attcan!uunet!lll-winken!ames!elroy!cit-vax!macondo!johns

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!attcan!uunet!lll-winken!ames!elroy!cit-vax!macondo!johns
From: johns@macondo.Caltech.Edu (John Salmon)
Newsgroups: comp.std.c
Subject: a scanf question and a preprocessor question
Message-ID: <9772@cit-vax.Caltech.Edu>
Date: 25 Feb 89 21:42:51 GMT
Sender: news@cit-vax.Caltech.Edu
Reply-To: johns@wega.caltech.edu (John Salmon)
Distribution: na
Organization: California Institute of Technology
Lines: 27