Replace repetitive code in SettingsObjectWrapper.cpp by functions?

Lubomir I. Ivanov neolit123 at gmail.com
Sat Nov 18 10:21:34 PST 2017


On 18 November 2017 at 20:19, Berthold Stoeger
<bstoeger at mail.tuwien.ac.at> wrote:
> On Samstag, 18. November 2017 17:23:05 CET Lubomir I. Ivanov wrote:
>> On 18 November 2017 at 17:53, Dirk Hohndel <dirk at hohndel.org> wrote:
>> >> On Nov 18, 2017, at 12:02 AM, Berthold Stoeger
> <bstoeger at mail.tuwien.ac.at> wrote:
>> <snip>
>>
>> >> For consistency, I made a few C-strings non-const. And ultimately also
>> >> the
>> >> return of system_default_filename(void). If preferred, the latter could
>> >> be kept const and the const cast away when assigning to the item of the
>> >> pref struct.>
>> > That I'm not so sure about. We try to use these const declarations to
>> > prevent users of these strings from modifying them when they are supposed
>> > to be immutable.
>>
>> i agree that things like system_default_...() calls should return a
>> "const char *".
>>
>> const char *language;
>> const char *lang_locale;
>>
>> ^ also make sense to me to be "const".
>
> I see your point. But shouldn't then the numerous other non-const strings in
> pref.h also be made const?
>

probably, yes.

lubomir
--


More information about the subsurface mailing list