This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: isinf


Joe Buck <Joe.Buck@synopsys.COM> writes:

>> >> The configure script which is included in rrdtool[1] checks whether
>> >> the system has isinf() as below.
>> >>
>> >> #include <math.h>
>> >> int
>> >> main ()
>> >> {
>> >> float f = 0.0; isinf(f)
>> >>   ;
>> >>   return 0;
>> >> }
>> >
>> > The test is clearly fragile.  Assigning the return value of isinf to a 
>> > variable should be sufficient for 4.0.x at -O0.
>
> Best to make it a global variable, to guard against dead code elimination.

Oops, the configure script compiling with -O2 optimization.  The
compilation of the following code still suceesss.

#include <math.h>

int a;

int
main ()
{
  float f = 0.0;
  a = isinf (f);
  return 0;
}

Do I misunderstand?  Since I am the newbie of C, I consulted this page:
http://www.phim.unibe.ch/comp_doc/c_manual/C/SYNTAX/glo_int_vars.html

-- 
Hiroshi Fujishima


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]