Re: warning: implicit declaration of function =?UTF-8?B?77+9Zmlu?= =?UTF-8?B?aXRl77+9?=



At 30.11.2008 12:18, Sameer Sahasrabuddhe wrote:
[...]
I am no expert at portable code, and this much investigation has
itself been instructive. What is the best way to remove the warning?

a) A portable way to check whether a float is finite, is made
available by the C99 in the form of the "isfinite" macro. This
eliminates all the platform specific #defines needed in the current
code. What is affected if we enable C99? Dia compiles with gcc when
using C99 mode, but I don't know the state of other platforms.

The main reason for adding -std=c89 was me being tired on fixing c99ism alone ;) On win32 the compiler (family) used for Dia compilation still does not support C99 - and probably never will. The most annoying issue with C99 on gcc-only was declarations not at the beginning of a block. Now mildly annoying are single line comments being silently ignored on win32/msvc but breaking the build for linux/gcc.

b) If the plan is to stick to C89, then we must define __USE_MISC
before <math.h> is included, when using gcc. This is equivalent to the
Windows- and OS/2-specific code that defines the "finite" macro in
platform-dependent ways. I suppose the correct place for this is
<config.h>, probably through the auto-tools.

Having a gcc specific define in lib/geometry.h would be fine with me.

Note that this "problem" is merely academic (for now). The current
code works (with warnings) using the current set of compilers, and I
do believe in not fixing things that aren't broken yet, but still ...

If you look for c89 in the ChangeLog you'll find one bug which indeed was caused by an undefined function and c89. Patches accepted ;-)

        Hans

-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to
get along without it.                -- Dilbert



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]