Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #62568

Re: Need help with an odd error...

From Stephen Sprunk <stephen@sprunk.org>
Newsgroups comp.lang.c
Subject Re: Need help with an odd error...
Date 2015-05-24 19:15 -0500
Organization A noiseless patient Spider
Message-ID <mjtphn$5rt$1@dont-email.me> (permalink)
References <mjtj7h$nlo$1@speranza.aioe.org> <mjtkn3$opd$1@dont-email.me>

Show all headers | View raw


On 24-May-15 17:53, James Kuyper wrote:
> When C was first developed, the time to link a program could be quite
> large, depending upon the libraries linked in. The math library was
> fairly large, and while some programs make heavy use of it, many other
> programs make no use of it at all. To reduce the link times for
> programs in the second category, linking in the math library was made
> optional, and the option was off by default.

Linking was typically static back then, so linking in a bunch of unused
math functions might make a binary larger than necessary, on top of
being slower.

A _lot_ of code went to great lengths to avoid anything requiring
floating point since most CPUs of the day didn't have hardware support
for it; linking the math library might also link in a software emulation
layer that was never used, further adding to the bloat.

Also, while _you_ may not call anything in the math library, you almost
certainly call printf(), which does need (parts of) the math library for
handling certain argument types--and that results in dragging in a bunch
of other functions.

The solution was a stripped-down version of printf() in libc and the
full version of printf() in libm, with the latter taking precedence
during the linking process, e.g. via "weak" and "strong" symbols.

It's tempting to stop all this nonsense, but there are _still_ some
embedded systems out there with no FPU and scarce RAM, and most folks
have learned to live with this quirk, so it's not worth changing.

S

-- 
Stephen Sprunk         "God does not play dice."  --Albert Einstein
CCIE #3723         "God is an inveterate gambler, and He throws the
K5SSS        dice at every possible opportunity." --Stephen Hawking

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Need help with an odd error... "Chris M. Thomasson" <cristom@charter.net> - 2015-05-24 15:26 -0700
  Re: Need help with an odd error... Keith Thompson <kst-u@mib.org> - 2015-05-24 15:38 -0700
  Re: Need help with an odd error... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-24 23:39 +0100
  Re: Need help with an odd error... James Kuyper <jameskuyper@verizon.net> - 2015-05-24 18:53 -0400
    Re: Need help with an odd error... Stephen Sprunk <stephen@sprunk.org> - 2015-05-24 19:15 -0500
  Re: Need help with an odd error... "Chris M. Thomasson" <cristom@charter.net> - 2015-05-24 16:18 -0700
    Re: Need help with an odd error... "Chris M. Thomasson" <cristom@charter.net> - 2015-05-24 16:54 -0700
    Re: Need help with an odd error... Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-05-27 19:48 +0200

csiph-web