[linux-audio-dev] [ot] [rant] gcc, you let me down one time too many
N Smethurst
nick.smethurst at free.fr
Thu Jun 9 07:40:23 UTC 2005
Chris Cannam a écrit :
>Yes, indeed, but a couple of times here I've seen observations that a
>vector would compile to an array if optimisation was on, etc. Since
>we're mostly using gcc-3.3+ now, I wanted to ask if anyone is sure
>whether that's really true.
>
>
Since a vector is a wrapped C array (i.e. contigous), the [] operator
compiles to the C equivalent when optimisation is turned on. The result
is the same as a C array.
Thinking about it logically, why would the developers of a C++ standard
library choose a different method? The std::vector is meant to be the
C++ replacement to C arrays, so a slow down in speed would effectively
render it useless.
However, last time I checked, GCC does not inline functions with -02
(only with -O3), so I always specify -finline-functions when compiling.
More information about the Linux-audio-dev
mailing list