Turning on ALL C extensions.

S

Samantha

Hi - In order to use log2l() and log2f() in C, I apparently have to
include some C99 extension for math.h..Can anyone tell me what that
is? Also - how do I turn on ALL extensions? thanks!
 
J

jacob navia

Samantha said:
Hi - In order to use log2l() and log2f() in C, I apparently have to
include some C99 extension for math.h..Can anyone tell me what that
is? Also - how do I turn on ALL extensions? thanks!

Yes. Your compiler looks like a gcc derivate or even
gcc itself...

To do that just call gcc with

gcc -std=c99 myfile.c -lm

(1) Note that c99 != C99, and C99 is not recognized.
(2) Note that you have to include manually the math library
(argument -lm since gcc isn't able to do that by itself)
 
K

Keith Thompson

Samantha said:
Hi - In order to use log2l() and log2f() in C, I apparently have to
include some C99 extension for math.h..Can anyone tell me what that
is? Also - how do I turn on ALL extensions? thanks!

The log2l() and log2f() functions, declared in <math.h>, were added in
C99; they didn't exist in the C90 standard (though I think they were
mentioned in the future library directions section).

Almost all C compilers these days fully support the C90 standard.
Many of them partially support the C99 standard. Very few fully
support the C99 standard.

The way to enable C99 features in your compiler is a question about
your compiler, not about the C language. Your best bet is to consult
the documentation for your compiler.

(I happen to know that the "-std=c99" option does this for gcc; if
you're using gcc, you should read the documentation to see exactly
what this option does.)
 
U

user923005

The log2l() and log2f() functions, declared in <math.h>, were added in
C99; they didn't exist in the C90 standard (though I think they were
mentioned in the future library directions section).

Almost all C compilers these days fully support the C90 standard.
Many of them partially support the C99 standard.  Very few fully
support the C99 standard.

The way to enable C99 features in your compiler is a question about
your compiler, not about the C language.  Your best bet is to consult
the documentation for your compiler.

(I happen to know that the "-std=c99" option does this for gcc; if
you're using gcc, you should read the documentation to see exactly
what this option does.)

If you have a compiler that does not support these functions, there
are implementations in the Cephes collection.
http://www.moshier.net/#Cephes
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top