On 18 November 2017 at 17:53, Dirk Hohndel <[email protected]> wrote: > Hi Berthold, > >> On Nov 18, 2017, at 12:02 AM, Berthold Stoeger <[email protected]> >> 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". >> Note that this is really only a quick proof of concept and I probably >> introduced numerous bugs. But if you think this is a good idea, I can try to >> go over each case and check it for plausibility. > > The scary part (for me) is that you are using C++ constructs outside of my > comfort zone. I have always pushed back when Tomaz went into what I > consider C++-lala-land. > I think I mostly understand what the template does and how the namespace > is used, but I realize that I'd be uncomfortable editing this code without > some > serious Googling and that makes me nervous. > > That's not to say that this is wrong. It's to say that I really want to see > what > Tomaz or some other C++ programmers think about it. > > Linus and I are fundamentally C programmers who use C++ because we > have to in order to be able to use Qt. I'm getting more comfortable with > some of the classes in Qt and their advantages, but I'm still not someone > who feels super comfortable with C++ as a whole. > i would agree that we are a mostly a C centralized team. we don't have C++ template usage in subsurface, yet. it's one of those things that can become messy with excessive usage. but at the same time it's very nice in this particular usage case - typed getters and setters. it moves the bloat away from the source code and is generated as object code bloat at compile time. that said, i don't like debugging such object code. benefits? - less source code difficult to debug? - yes, more difficult than (overloaded) non-templated getters and setters i'm 60% OK with limited template usage of this type, as long as templates don't propagate in the *entire app* and nobody want's to touch it anymore. lubomir -- _______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
