By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,370 Members | 1,574 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,370 IT Pros & Developers. It's quick & easy.

Standard C library functions

P: n/a
On what basis it is decided that a particular funtion should
be a part of Standard C library ?

Do I get these standard C libraries along with the C compiler ?
Or I can use the c complier from one vendor and the standard
C libraries from the different vendor ?

Also, the C standard (N869), page 164, refers to "standard
headers". Do I get these standard headers along with the
C compiler ?

Nov 15 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a

ju**********@yahoo.co.in wrote:
On what basis it is decided that a particular funtion should
be a part of Standard C library ? Post this question in comp.std.c, you will get a better answer. Do I get these standard C libraries along with the C compiler ? Not all the compilers follow the ANSI C standard,for example, M$
compiler.Most compilers have their own libraries.If you are strict in
the standard,try gcc with the option -ansi. Or I can use the c complier from one vendor and the standard
C libraries from the different vendor ? Er,...... Also, the C standard (N869), page 164, refers to "standard
headers". Do I get these standard headers along with the
C compiler ?

At most times,you do.But this also depends on your compiler.

Nov 15 '05 #2

P: n/a
"Cong Wang" <xi************@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
ju**********@yahoo.co.in wrote:
On what basis it is decided that a particular funtion should
be a part of Standard C library ? Post this question in comp.std.c, you will get a better answer.
There are almost as many answers as functions.
Do I get these standard C libraries along with the C compiler ? Not all the compilers follow the ANSI C standard,for example, M$
compiler.
If you meant to designate the Microsoft VC++ compiler, you
mistakenly used a dollar sign in place of the S. You're also
wrong. VC++ has conformed pretty closely to the C90 standard
for many years. It gets just a couple of things wrong with C95,
and hasn't really tried to conform to C99 yet. It also has
quite a number of extensions that it has accreted over the
years.

Now, the same thing can be said of *essentially every*
desktop C compiler available today. So what's your point?
Most compilers have their own libraries.
True. Only a few not-quite-C compilers for small embedded
processors omit most or all of the library. To fully
conform to the C Standard, a compiler is *obliged* to
supply a library as well.
If you are strict in
the standard,try gcc with the option -ansi.
True. Most compilers have a similar compile-time option,
to better check your program for conformance to the C
Standard.
Or I can use the c complier from one vendor and the standard
C libraries from the different vendor ? Er,......
Generally, no. There's enough machine and compiler specific
tailoring required that one C library just won't work with
another compiler. Dinkumware is unique in having the only
commercial compiler-independent Standard C library, so ours
does indeed work with quite a few compilers. It's one way to
get all the extra C99 functions with an existing C compiler.
(But it costs $ to license.)
Also, the C standard (N869), page 164, refers to "standard
headers". Do I get these standard headers along with the
C compiler ?

At most times,you do.But this also depends on your compiler.


If you get the library, you get the headers. See above.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
Nov 15 '05 #3

P: n/a
On Wed, 03 Aug 2005 06:43:40 -0400, P.J. Plauger wrote:
"Cong Wang" <xi************@gmail.com> wrote
ju**********@yahoo.co.in wrote:
Or I can use the c complier from one vendor and the standard
C libraries from the different vendor ?
Er,......


Generally, no. There's enough machine and compiler specific
tailoring required that one C library just won't work with
another compiler. Dinkumware is unique in having the only
commercial compiler-independent Standard C library, so ours
does indeed work with quite a few compilers. It's one way to
get all the extra C99 functions with an existing C compiler.
(But it costs $ to license.)
Also, the C standard (N869), page 164, refers to "standard
headers". Do I get these standard headers along with the
C compiler ?

At most times,you do.But this also depends on your compiler.


If you get the library, you get the headers. See above.


Out of curiosity - I couldn't see it mentioned on your website - how much
emphasis does the Dinkum C99 Library place on purely standards-compliant
code? Obviously there are places where things must be tailored to an
implementation such as header files defining types, but otherwise does the
library ever have any specific code optimised for a particular platform
(whether that be standard or non-standard code), or is it completely
generic?

And what sort of issues would prevent the library from being used with a
particular compiler?

Nov 15 '05 #4

P: n/a
"Netocrat" <ne******@dodo.com.au> wrote in message
news:pa****************************@dodo.com.au...
On Wed, 03 Aug 2005 06:43:40 -0400, P.J. Plauger wrote:
"Cong Wang" <xi************@gmail.com> wrote
ju**********@yahoo.co.in wrote: Or I can use the c complier from one vendor and the standard
C libraries from the different vendor ?
Er,......


Generally, no. There's enough machine and compiler specific
tailoring required that one C library just won't work with
another compiler. Dinkumware is unique in having the only
commercial compiler-independent Standard C library, so ours
does indeed work with quite a few compilers. It's one way to
get all the extra C99 functions with an existing C compiler.
(But it costs $ to license.)
Also, the C standard (N869), page 164, refers to "standard
headers". Do I get these standard headers along with the
C compiler ?

At most times,you do.But this also depends on your compiler.


If you get the library, you get the headers. See above.


Out of curiosity - I couldn't see it mentioned on your website - how much
emphasis does the Dinkum C99 Library place on purely standards-compliant
code? Obviously there are places where things must be tailored to an
implementation such as header files defining types, but otherwise does the
library ever have any specific code optimised for a particular platform
(whether that be standard or non-standard code), or is it completely
generic?


It's pretty generic, but we have to tailor in several ways:

-- stdarg.h and setjmp.h are *extremely* compiler specific. (In
many cases we simply defer to the ones supplied with the compiler,
but when we mess with these, we do so carefully.)

-- We determine the representation of various flexible types,
as you observe.

-- We determine the values of numeric limits, with special care
for twos-complement encodings.

-- We determine the various floating-point formats. We have a set
of about half a dozen math primitives that ensure a reasonable
tradeoff between portability, precision, and speed. They support
precisions from 24 bits to 113 bits, and exponent ranges from
2^128 to 2^16384, with all IEEE special cases.

-- We provide common nonstandard extensions to the C library,
either by replicating them or letting them "shine through".

--We determine the needed underlying system-call primitives
for I/O, program startup/shutdown, etc. These are very OS
specific.

-- We provide multithreading support, in both C and C++, which
also depends strongly on the underlying OS.

There are probably other things, but that's off the top of my
head.
And what sort of issues would prevent the library from being used with a
particular compiler?


See above.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
Nov 15 '05 #5

P: n/a

<ju**********@yahoo.co.in> wrote

On what basis it is decided that a particular funtion should
be a part of Standard C library ?
K and R decided that C would be a very slim language, with for instance no
string handling statements beyond embedding a string literal, no IO, no
mathematical or memory operations. All these things are provided by every
general-purpose language, and in C they were implemented as standard
functions.
When ANSI standardised the language, they inherited K and R's library. They
made a few minor alterations - for instance the va-start macro now always
takes the last fixed parameter as an argument, malloc() takes a size_t. But
they kept the changes to a minimum.
Chris Torek who posts here is a member of the ANSI committee, and one of the
people who decides such issues.
Do I get these standard C libraries along with the C compiler ?
Almost always you do. The exception is C for small embedded systems, and
also for a few larger systems like games consoles.
Or I can use the c complier from one vendor and the standard
C libraries from the different vendor ?
Unlikely. The libraries have to be binary compatible, and there's not much
motivation for reimplementing someone else's standard library. However Mr
Plauger, elsethread, has made a living out of providing standard libraries
for people needing one for some special purpose. His book is one of the must
haves that every C programmer should read.
Also, the C standard (N869), page 164, refers to "standard
headers". Do I get these standard headers along with the
C compiler ?

Yes. The headers should ship with the library. Just occasionally there won't
be a physical file, and it will be built into the complier (you still
#incluce <stdio.h>).

Nov 15 '05 #6

P: n/a
Malcolm <re*******@btinternet.com> wrote:

Chris Torek who posts here is a member of the ANSI committee, and one of the
people who decides such issues.


Would that he were, but alas he is not.

-Larry Jones

It's no fun to play games with a poor sport. -- Calvin
Nov 15 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.