[patch] std::string::operator[] extension in debug mode
Douglas Gregor
doug.gregor@gmail.com
Thu May 19 15:29:00 GMT 2005
On May 19, 2005, at 8:43 AM, Paolo Carlini wrote:
>> We might also want to mark operator[] with the "always_inline"
>> attribute, so that we never get two conflicting definitions of the
>> same code.
>
> I'm not 100% sure to follow your reasoning here: actually, this
> specific
> issue (debug-mode vs string) is *not* limited to operator[]... This
> thread started with that subtle issue about the v3 extension, then
> Jonathan moved to the much more general problem with debug-mode
> basically not active for basic_string<char> and basic_string<wchar_t> ,
> being the latter instantiated in the library.
I hadn't realized it affected all of basic_string<char> and
basic_string<wchar_t>.
> We have *a lot* of
> _GLIBCXX_DEBUG_* and I'm not sure we can enforce inlining for all of
> them... If this is *really* a requirement from the ODR point of view,
> I'm not sure, on the spot: I'd like to hear the opinion of the list...
It really depends on how the explicit instantiations play with the
implicit instantiation. If the explicit instantiation is picked, we
don't get any checking. As far as I'm concerned, if turning off extern
templates produces the right behavior, the ODR violation is IMO not a
practical problem and not worth fixing.
Doug
More information about the Libstdc++
mailing list