Modula2's godawful IO.
Henry Spencer
henry at utzoo.uucp
Sun Apr 24 11:02:12 AEST 1988
> ... The C compiler on the
> Onyx Z8000 (R.I.P.) would generate a symbol "_fltused" if any
> floating point of any kind was used in that particular module.
> When the linker went to resolve everything, it loaded in the
> floating-point emulator if this symbol was found and didn't if it
> wasn't. As far as I could tell, this symbol was nothing more
> than a indicator to ld(1). Does anybody else do this? ...
Onyx borrowed this from the original pdp11 C implementation, in fact, which
used this technique to pick up a non-floating-point printf if floating
point was not in use. It didn't even require any special trickery in the
linker: generate an external reference to fltused when floating-point is
used; have two versions of the internal floating-point-formatting function,
one which implements the full show and also defines fltused and one which
does the integer subset and doesn't define fltused; and arrange for the
fltused version to be seen by the linker before printf and the non-fltused
version are seen.
> ... It seems so much more reasonable than the ubiquitous "-f" flag.
It's a reasonable substitute for -f only if you assume that the hardware
never has proper floating-point support, or if you don't care about hauling
the floating-point software along unnecessarily. The Onyx came under the
former heading, as I recall.
--
"Noalias must go. This is | Henry Spencer @ U of Toronto Zoology
non-negotiable." --DMR | {ihnp4,decvax,uunet!mnetor}!utzoo!henry
More information about the Comp.lang.c
mailing list