Bill Allombert on Thu, 06 May 2004 00:17:38 +0200


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

Re: link error log2 exp2 gcc 3.4.0 and resolution


On Wed, May 05, 2004 at 09:00:21PM +0200, Karim Belabas wrote:
> * Bill Allombert [2004-05-05 13:31]:
> > 2) That does not check whether the prototype for log2 exists, only
> >    if the log2 symbol is in the library.
> 
> This is correct, that's all we want. We do not want to try and work around
> unknown, possibly broken or conflicting, headers. The autoconf way to do
> things is even more paranoid:
> 
>   #ifdef __cplusplus
>   extern "C"
>   #endif
>   /* We use char because int might match the return type of a gcc2
>      builtin and then its argument prototype would still apply.  */
>   char fun ();
>   int main () { fun (); return 0; }

Are you sure ? I think it use

char (*f) () = $ac_func;

int
main ()
{
  return f != $ac_func;
}

which will not compile if $ac_func has no prototype since,
char (*f) () = $ac_func will report error: `$ac_func' undeclared'.

> Anyway, it's quite unimportant to "miss" either exp2 or log2: both are
> almost unused.

We will not miss it, we will find it where it is supposed to be hidden.
We will try to use log2() without prototype which is likely to fail
with a C++ compiler. Fortunately g++-3.3 default to C99 which has a
prototype for log2() so we don't see the problem, but it is by sheer
luck.

Cheers,
Bill.