Article View: comp.windows.interviews
Article #1324InterViews 3.1b3 doc: VAXCRTL doesn't like "%g" formatted input
From: Heribert Dahms
Date: Tue, 15 Dec 1992 12:25
Date: Tue, 15 Dec 1992 12:25
41 lines
2059 bytes
2059 bytes
I had problems with my VMS port of the InterViews 3.1-beta3 doc editor
which crashed either because of "divide by zero" or "floating overflow".
I've found that the formatted input routines in VAXCRTL don't like "%g".
They refuse to change the float's value and don't increment the return value
(success counter). I think that it is not a real bug, because table 2-2 of
the "VAX C Run-Time Library Reference Manual" (February 1991, VAX C 3.2 for
VMS 5.2 or higher) doesn't list "%g" as allowed for input.
But in fact, GCC relies on it, so it's not ANSI-C compatible.
BTW: We use GCC 2.2.2 and VMS 5.5-1 .
Suggested Workaround:
Change all "%g" to "%e" in input formatting strings.
I've done this in: (original UNIX names)
src/bin/doc/document.c (2 lines)
src/bin/doc/idrawimage.c (3 lines)
The following shows what's going on:
=========================================================================
#include <stdio.h>
main() {
float f;
int s;
printf("%g\n", f);
s = sscanf("10.0","%g",&f);
printf("%g %d\n", f, s);
s = sscanf("10.0","%e",&f);
printf("%g %d\n", f, s);
}
=========================================================================
$ run main
2.350989e-38
2.350989e-38 0
10 1
=========================================================================
I'll post this to both comp.os.vms and comp.windows.interviews .
Thanks, Heribert (dahms@ifk20.mach.uni-karlsruhe.de)
Technical Details
Message-ID:
<1gkirdINNlrf@nz12.rz.uni-karlsruhe.de>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!spool.mu.edu!yale.edu!ira.uka.de!rz.uni-karlsruhe.de!rz.uni-karlsruhe.de!usenet@rzShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!spool.mu.edu!yale.edu!ira.uka.de!rz.uni-karlsruhe.de!rz.uni-karlsruhe.de!usenet@rz From: DAHMS@ifk20.mach.uni-karlsruhe.de (Heribert Dahms) Newsgroups: comp.windows.interviews,comp.os.vms Subject: InterViews 3.1b3 doc: VAXCRTL doesn't like "%g" formatted input Date: 15 Dec 1992 12:25:17 GMT Organization: University of Karlsruhe, FRG (Dept. of Mechanical Engineering) Lines: 41 Distribution: world Message-ID: <1gkirdINNlrf@nz12.rz.uni-karlsruhe.de> NNTP-Posting-Host: ifk29.mach.uni-karlsruhe.de X-News-Reader: VMS NEWS 1.20