Linking of <stdio.h>

C

Ciko

Still not clear to me: why whe use <stdio.h> I haven't link stdio
library (in linking stage) while if I use something of <math.h> I must
link this library? Thanks in advance.
 
E

Eric Sosman

Ciko wrote On 02/21/06 11:12,:
Still not clear to me: why whe use <stdio.h> I haven't link stdio
library (in linking stage) while if I use something of <math.h> I must
link this library? Thanks in advance.

It's an accident of history. All but a tiny minority
of C programs need at least some parts of the C library,
so the "base" library is automatically included in the link
(on most systems). However, only a few programs use the
mathematical functions, so many systems place them in a
separate library that is linked only if requested. In the
days when computers were small and disks were slow, one
could save a noticeable amount of time by not making the
linker process libraries that the program wouldn't need.

I emphasize that all this is system-specific. Some
systems do not segment the library in this manner, but
instead automatically link an "omnibus" library containing
all the Standard functions (often non-Standard functions,
too). Even among the systems where separate libraries have
been traditional there seems to be a movement towards a
single library. The need for "-lm" or "/LIB=LIBMATH" or
whatever may eventually dwindle away.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,175
Messages
2,570,944
Members
47,491
Latest member
mohitk

Latest Threads

Top