C99 std documentation

L

Lars Tackmann

Is there a good online description of the ansi c99 std lib - sinse many of
the functions describet in k&r (eg. ceil is missing) does not seam to be
in c99.

Thanks.
 
S

Simon Biber

Lars Tackmann said:
Is there a good online description of the ansi c99 std lib - sinse
many of the functions describet in k&r (eg. ceil is missing) does
not seam to be in c99.

The Dinkum C99 Library reference is probably the best I've found,
short of paying your US$18 to ANSI to download the PDF of the
actual C99 standard.

www.google.com/search?q=dinkum+c99+library
 
P

pete

Lars said:
Is there a good online description of the ansi c99 std lib
- sinse many of the functions describet in k&r
(eg. ceil is missing) does not seam to be in c99.

It seems to be in N869.

http://anubis.dkuug.dk/jtc1/sc22/wg14/www/docs/n869/

Committee Draft -- January 18, 1999 WG14/N869

7.12.9.1 The ceil functions
Synopsis
[#1]
#include <math.h>
double ceil(double x);
float ceilf(float x);
long double ceill(long double x);
Description
[#2] The ceil functions compute the smallest integer value
not less than x: |x|.
Returns
[#3] The ceil functions return the smallest integer value
not less than x, expressed as a floating-point number.
 
J

Jack Klein

Is there a good online description of the ansi c99 std lib - sinse many of
the functions describet in k&r (eg. ceil is missing) does not seam to be
in c99.

Thanks.

What makes you think that they are not in C99? What are you using to
determine that, if you don't have a reference? There were no
functions at all removed from the standard library by C99. ceil() is
still there, along with specialized float and long double versions
added.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
 
L

Lars Tackmann

What makes you think that they are not in C99? What are you using to
determine that, if you don't have a reference? There were no
functions at all removed from the standard library by C99. ceil() is
still there, along with specialized float and long double versions
added.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq

Well when I looked in the math.h header - there is no ceil
function/prototype and my linker (included with gcc 3.2.2) says

gcc -std=c99 test.c

/tmp/ccofZXVf.o(.text+0x19): In function `insert':
: undefined reference to `ceil'
/tmp/ccofZXVf.o(.text+0x6c): In function `insert':
: undefined reference to `ceil'
collect2: ld returned 1 exit status

and yes i have included math.h, the code compiles fine with gcc 2.96. So
is it just the gnu implementation there is buggy or am i suposed to include
som other file in order to get that functionX.


thanks
 
A

Alan Balmer

Well when I looked in the math.h header - there is no ceil
function/prototype and my linker (included with gcc 3.2.2) says

Your initial question (Is ceil included in C99?) is answered. The
question of how to persuade gcc to let you use it should be asked in
another newsgroup.
 
A

Alexander Bartolich

begin followup to Lars Tackmann:
gcc -std=c99 test.c

/tmp/ccofZXVf.o(.text+0x19): In function `insert':
: undefined reference to `ceil'

Add -lm to your compiler flags.
 
A

August Derleth

00:44p:
Well when I looked in the math.h header - there is no ceil
function/prototype and my linker (included with gcc 3.2.2) says

gcc -std=c99 test.c

/tmp/ccofZXVf.o(.text+0x19): In function `insert':
: undefined reference to `ceil' /tmp/ccofZXVf.o(.text+0x6c): In function
: `insert': undefined reference to `ceil' collect2: ld returned 1 exit
: status

[OT]
That's the linker talking to you, not the compiler. (See that the file is
now in /tmp and has a name no rational human would give it? That's where
the assembler shoved the object code once it had generated it.) The linker
doesn't like that you didn't tell it to link against libm.a, the GNU
Project's math library, and now it can't find ceil. The best way to link
against libm.a is to add the flag -lm to your gcc command line. The
compiler will pass it along to the linker, and the linker will be happy.

Some people consider this to be a mistake in how the GNU Compiler
Collection was designed. I say, it's the price of using a great build
environment.
[/OT]

In any case, this is all massively off-topic here. Try
comp.linux.programmers or some such.
 
S

Simon Biber

While we're off-topic,

August Derleth said:
[OT] ....
Some people consider this to be a mistake in how the GNU Compiler
Collection was designed. I say, it's the price of using a great
build environment.

The split of the C library into libc and libm is a historical UNIX
thing. The problem has nothing to do with the design of the GNU
Compiler Collection, and existed long before GCC did.

Other compilers on Unix also require separate linking of the math
section of the C library. GCC on other platforms does not require
separate linking of the math section. Therefore, libm is orthogonal
to GCC.
 
D

Dan Pop

In said:
While we're off-topic,

August Derleth said:
[OT] ...
Some people consider this to be a mistake in how the GNU Compiler
Collection was designed. I say, it's the price of using a great
build environment.

The split of the C library into libc and libm is a historical UNIX
thing. The problem has nothing to do with the design of the GNU
Compiler Collection, and existed long before GCC did.

Other compilers on Unix also require separate linking of the math
section of the C library. GCC on other platforms does not require
separate linking of the math section. Therefore, libm is orthogonal
to GCC.

Especially considering that gcc is a compiler only, while the math
library functions are, obviously, a library issue.

Merge libc and libm together on a Unix system and gcc won't need any -lm
option to properly link programs using the <math.h> stuff.

Dan
 
A

Alan Balmer

While we're off-topic,

August Derleth said:
[OT] ...
Some people consider this to be a mistake in how the GNU Compiler
Collection was designed. I say, it's the price of using a great
build environment.

The split of the C library into libc and libm is a historical UNIX
thing. The problem has nothing to do with the design of the GNU
Compiler Collection, and existed long before GCC did.

Other compilers on Unix also require separate linking of the math
section of the C library. GCC on other platforms does not require
separate linking of the math section. Therefore, libm is orthogonal
to GCC.

Some implementations had several math libraries, and allowed the
programmer to use linker directives to choose the one he wanted to
use. One for hardware FPP, one for another variety of FPP, one for
proprietary software floating point, one for software emulation of a
hardware FPP, one which would test for the presence of an FPP and use
software emulation if it wasn't present, etc.
 

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,137
Messages
2,570,797
Members
47,345
Latest member
tektheone

Latest Threads

Top