c++ variable-length array?

2006-07-21 Thread Neal Becker
Using gcc-4.1.1. Info says variable-length array is supported in c++ mode, but doesn't seem to work: #include #include template void F (in_t const& in, int size, int x[size]) {} void G (std::vector const& in, int size, int x[size]) {} int main () { std::vector i (10); int x (10); F (i,

std::isfinite broken?

2008-07-28 Thread Neal Becker
gcc-4.3.0-8.x86_64 I have test code that does passes std::isfinite (x), yet if I print the values to std::cout the value printed is 'inf'. Is std::isfinite (x) broken?

Re: std::isfinite broken?

2008-07-28 Thread Neal Becker
Paolo Carlini wrote: > Neal Becker wrote: >> gcc-4.3.0-8.x86_64 >> >> I have test code that does passes std::isfinite (x), yet if I print the >> values to std::cout the value printed is 'inf'. Is std::isfinite (x) >> broken? >> > Whatever

Re: std::isfinite broken?

2008-07-28 Thread Neal Becker
Paolo Carlini wrote: > ... ah, ok, now I see what you meant, you meant that x is *not* finite, > still, std::isfinite(x) != 0. Still, testcase badly needed... > > Paolo. #include #include int main () { double x = log (0); if (not std::isfinite (x)) { throw std::runtime_error ("not fini

Re: std::isfinite broken?

2008-07-31 Thread Neal Becker
Paolo Carlini wrote: > Hi ho, ho!! ;) >> It worked with me. >> > Try a recent gcc (eg, 4.3.x) and you will get the same, actually > expected, result of the original poster. > > Paolo. I believe this is a bug. I agree that -ffast-math will not always comply 100% with IEEE, as advertised. Bu

missing optimization - don't compute return value not used?

2007-09-26 Thread Neal Becker
gcc version 4.1.2 20070502 (Red Hat 4.1.2-12) I noticed the following code === version 1: template inline a_t append (a_t & a, b_t const& b) { a.insert (a.end(), b.begin(), b.end()); return a; } === version 2: template inline void append (a_t & a, b_t const& b) { a.insert (a.end(), b.begin(

__GXX_EXPERIMENTAL_CXX0X__

2010-10-21 Thread Neal Becker
I need a preprocessor macro to detect c++0x support. For now, that is __GXX_EXPERIMENTAL_CXX0X__ but what happens once -std=c++0x is the default? Will this macro still be defined? Don't we need a __GXX_CXX0X__ ?