Different code behaviour in Unix & Windows

G

Giorgos Keramidas

round() is standard in C99, but not in C90.

I think we recently had a thread here where someone's compiler (I
think it was gcc) recognized round(), possibly implementing it with
inline code, but the system's <math.h> header didn't declare it.

I remember one about pow() being replaced by GCC at compile time with
the result for some values. Perhaps this is the one you recall too?

The starting message was the one with:

From: Mark Healey <[email protected]>
Subject: I can't seem to use pow()
Message-Id: said:
(The compiler, headers, and library are all part of the implementation
as far as the standard is concerned, but if they're provided by
different vendors or other entities they can be inconsistent.) Since
no declaration for round() was visible, the compiler had to assume
that it returns int. (And no, casting the result to double is *not* a
fix for the problem; it merely masks the error.)

I have no idea whether that's the problem here, but it's worth
investigating.

The point made above is also valid though :)
 
K

Keith Thompson

Giorgos Keramidas said:
I remember one about pow() being replaced by GCC at compile time with
the result for some values. Perhaps this is the one you recall too?

The starting message was the one with:

From: Mark Healey <[email protected]>
Subject: I can't seem to use pow()
Message-Id: <[email protected]>

No, that wasn't it. The thread I'm thinking of had the subject
"undefined refrence to a function" (the typo should make it easy to
find in Google).
 

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,774
Messages
2,569,596
Members
45,140
Latest member
SweetcalmCBDreview
Top