gnu.gcc.help
[Top] [All Lists]

std=c99, std=gnu99, round()

Subject: std=c99, std=gnu99, round()
From:
Date: 7 Oct 2005 04:27:37 -0700
Newsgroups: gnu.gcc, gnu.gcc.help
Hi,

I am using gcc version 3.3.3 in Cygwin, and I am facing the following
problem:

I have a piece of code that calls function `round()':
  #include <math.h>
  [...]
  double x, y;
  [...]
  y = round(x);
  [...]

When I compile this code with option `std=c99', I get this error
message:
  warning: implicit declaration of function `round'

When I compile this code with option `std=gnu99', I no longer get that
error message.

According to gcc manual
(http://gcc.gnu.org/onlinedocs/gcc-3.2.3/gcc/C-Dialect-Options.html#C%20Dialect%20Options):
* `std=c99'   => ISO C99
* `std=gnu99' => ISO C99 plus GNU extensions

Well, the problem is that function `round()' is _not_ a GNU extension
to C99: `round()' is part of C99 (see section 7.12.9.6 of the C99
Standard).

So, why does calling `round()' require `std=gnu99'? Why is `std=c99'
not enough?

Note: I tried with and without `_ISOC99_SOURCE' defined, but that
didn't make any difference.

-- dave


<Prev in Thread] Current Thread [Next in Thread>