flag_complex_method = 2 in C++?

Mark Mitchell mark@codesourcery.com
Thu Jul 5 17:49:00 GMT 2007

Paolo Carlini wrote:

> Therefore, I'm not sure... I would certainly like to see method 2
> becoming the default everywhere, on the other hand, I'm not sure if
> method 2 isn't too slow as default for C89 (outside fast-math, I
> repeat). Shall we carry out performance tests perhaps, or peak
> performance outside fast-math aren't really an issue here? I don't know.

Performance tests would certainly be useful.

> In case of doubt, I would still switch to method 2 as default together
> with C++0x, in that case the reference C language is C99 and things are
> very neat...

The problem is that this isn't how users think about it.

If a user does:

  gcc test.c
  g++ test.c

and gets different performance between the two, I think we're going to
have a "C++ is slow" bug report.  In a certain sense, the user may be
right, in that C99/C++ mandate a slower approach than is used by GNU
C89.  But, because GNU C89 is the default, we still have a problem.

Since C99 has defined semantics for this, and C++ is following, it seems
reasonable to me to change C89 to always use these semantics.  Then,
some GNU C89 programs may go a bit slower, but we don't have weird
differences between the languages.  And, users can use -ffast-math to
get the performance back -- in all languages, uniformly.

Mark Mitchell
(650) 331-3385 x713

More information about the Gcc mailing list