Date: Sat, 6 Sep 1997 10:32:18 -0700 (PDT) Message-Id: <199709061732.KAA08691@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: djgpp AT delorie DOT com From: Nate Eldredge Subject: scanf and upper-case format letters Precedence: bulk I think I may have mentioned this before, but it got no response. I find it strange that the scanf family uses the case of the format letters to determine the size of a floating-point number. For example, according to the source, "%f" reads a float, but "%F" reads a double. There is already a bug whereby "%LF" reads a double instead of a long double, for which I posted a patch. However, I've been able to find no justification of this behavior. It seems to me the ANSI standard wants "%f" and "%F" to be the same, since in printf they just specify the case of the exponent 'e' (i.e. "1.23e4" vs. "1.23E4"). Also, the Linux libc, which I assume is ANSI-compliant, does nothing of the sort. So, IMHO, scanf shouldn't care at all whether you use upper or lower-case format letters. It should make no difference. Here's a patch to remove that `feature': *** doscan.c~ Sat May 18 21:40:02 1996 --- doscan.c Sat Sep 6 10:23:34 1997 *************** *** 93,96 **** --- 93,97 ---- } else if (ch=='[') fmt = _getccl((const unsigned char *)fmt); + #if 0 if (isupper(ch)) { /* ch = tolower(ch); *************** *** 103,106 **** --- 104,108 ---- size = LONG; } + #endif if (ch == '\0') return(-1); Please advise me on what you all think of this. It'd also be nice to know exactly what the ANSI standard says. Nate Eldredge eldredge AT ap DOT net