Need a convention for syntax for default values in members
Created by: stephanemagnenat
There is ongoing work to port the Aseba codebase to C++11 (and then 14), as described in issue #615. In that context, when it improves readability, some classes are updated to initialize members to their default value in their declaration, and not in the different constructors (see class Error
or SourcePos
in compiler/compiler.h
for example).
However, there are two ways of doing so, with an equal (eg. std::wstring message = L"not defined";
) or with a pair of braces (eg. std::wstring message{L"not defined"};
). I think that it would be helpful to decide for one syntax and specify it in the coding style guide.
Personally, I do not have a strong preference: I think that the equal syntax looks nicer but the braces somehow give more the feeling of the default value. I guess that is why there are both in the standard...