This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: [RFC] move COW basic_string and SSO basic_string to separate files


> Strongly in favor of a file split; the separate files become much less
> macro-infested.
+1

Ville Voutilainen writes:

> On Tue, 11 Dec 2018 at 18:15, Daniel Krügler <daniel.kruegler@gmail.com> wrote:
>>
>> Am Di., 11. Dez. 2018 um 15:31 Uhr schrieb Jonathan Wakely <jwakely@redhat.com>:
>> >
>> > Often when I'm poking around in <bits/basic_string.h> and/or
>> > <bits/basic_string.tcc> I lose context and am not sure if I'm looking
>> > at a member of the old string type or the new one. I've considered
>> > putting comments above each member definition in the .tcc file saying
>> > "COW" or "SSO" but asimpler solution might be to move the definitions
>> > to separate files.
>> >
>> > This has the additional advantage of only having to parse the one
>> > we're actually using in a given translation unit:
>> >
>> > #if _GLIBCXX_USE_CXX11_ABI
>> > # include <bits/sso_string.h>
>> > #else
>> > # include <bits/cow_string.h>
>> > #endif
>> >
>> > That's approx. 3500 fewer lines to preprocess per compilation.
>> >
>> > Are there advantages to having them both in one place? For example,
>> > when fixing a bug, is it helpful to be able to find all occurrences of
>> > a name in a single file, across both COW and SSO types? Since the
>> > members are already spread across the .h and .tcc files, I think that
>> > ship already sailed.
>>
>> I appreciate your suggested refactoring. As you say, assuming that
>> searching in the same file would be sufficient to perform a fix in
>> both places is an illusion. IMO it is much easier to work with the new
>> code structure in two separate files.
>
> Strongly in favor of a file split; the separate files become much less
> macro-infested.


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