[ale] Missing "floor"?

Sparr sparr0 at gmail.com
Wed Jun 19 12:51:34 EDT 2013


On Wed, Jun 19, 2013 at 12:02 PM, Ed Cashin <ecashin at noserose.net> wrote:

> Yes, ignoring stuff like inline functions defined in headers, standard
> UNIX-like expectations would be for the header math.h to contain a function
> *prototype* that *declares* floor.
>
> The library contains the compiled floor function *definition* as
> executable code for your architecture.  The source for the definition is
> part of glibc, probably a function body *defined* in a .c file.
>
> Both the source and the compiled form of the function can be thought of as
> the implementation in different forms.  The declaration in the header is
> information that the compiler can use to make sure that the types of the
> function parameters and of the return value are right.  You can think of
> the header stuff as "interface" as opposed to "implementation", but the C
> language and runtime aren't essentially modular, so you'll exhaust the
> usefulness of that metaphor if you go very deep.
>

Put another way... imagine math.* was actually part of your project, not a
system library. In addition to including math.h, you'd also need to tell
the compiler to compile/link math.c. That extra step is still required,
just instead of "gcc math.c file.c" you do "gcc -lm file.c"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20130619/c31eb966/attachment.html>


More information about the Ale mailing list