[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] Default values for default arguments
From: |
Greg Chicares |
Subject: |
Re: [lmi] Default values for default arguments |
Date: |
Sat, 11 Feb 2017 10:16:07 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0 |
On 2017-02-10 16:58, Vadim Zeitlin wrote:
>
> I'd also consider using "Foo{}" instead of "Foo()" for the constructors of
> temporary objects (although lmi code doesn't use them much, I think),
> because the former is much more clear as it doesn't look like a function
> call.
Discussion of selected `grep 'std::string()'` results:
datum_sequence.cpp: return std::string();
rate_table_test.cpp: stream_out_.str(std::string());
rate_table_tool.cpp: name_map.emplace(num, std::string());
In those cases, the type 'std::string' must be named, and I think you're
saying you'd prefer {} to ().
antediluvian_stubs.cpp: std::string const empty_string = std::string();
How about that one? Which of the following...
std::string const empty_string = std::string(); // Leave it alone.
std::string const empty_string = std::string{}; // Prefer {} to ().
std::string const empty_string{}; // Don't even name the type.
wx_test_paste_census.cpp: ,std::string const& unexpected = std::string()
How about this one, which is a defaulted argument? I ask this because
earlier we had decided to write that exactly as above. But it's okay
to change our minds; which would you now prefer?
,std::string const& unexpected = std::string()
,std::string const& unexpected = std::string{}
,std::string const& unexpected{}
- [lmi] Third-millennium GOTW#1: is <int> special? [Was: Default values for default arguments], (continued)
- [lmi] Third-millennium GOTW#1: is <int> special? [Was: Default values for default arguments], Greg Chicares, 2017/02/04
- Re: [lmi] Third-millennium GOTW#1: is <int> special?, Vadim Zeitlin, 2017/02/04
- Re: [lmi] Third-millennium GOTW#1: is <int> special?, Greg Chicares, 2017/02/05
- Re: [lmi] Third-millennium GOTW#1: is <int> special?, Vadim Zeitlin, 2017/02/06
- [lmi] More enabled warnings, less boost [Was: Third-millennium GOTW#1: is <int> special?], Greg Chicares, 2017/02/06
- Re: [lmi] More enabled warnings, less boost, Vadim Zeitlin, 2017/02/06
- Re: [lmi] More enabled warnings, less boost, Greg Chicares, 2017/02/06
- Re: [lmi] More enabled warnings, less boost, Vadim Zeitlin, 2017/02/06
Re: [lmi] Default values for default arguments, Greg Chicares, 2017/02/10
- Re: [lmi] Default values for default arguments, Vadim Zeitlin, 2017/02/10
- Re: [lmi] Default values for default arguments,
Greg Chicares <=
- Re: [lmi] Default values for default arguments, Greg Chicares, 2017/02/11
- Re: [lmi] Default values for default arguments, Vadim Zeitlin, 2017/02/11
- Re: [lmi] Default values for default arguments, Greg Chicares, 2017/02/11
- Re: [lmi] Default values for default arguments, Vadim Zeitlin, 2017/02/11
[lmi] () or {} in initializer lists [Was: Default values for default arguments], Greg Chicares, 2017/02/22
Re: [lmi] () or {} in initializer lists [Was: Default values for default arguments], Vadim Zeitlin, 2017/02/22
Re: [lmi] () or {} in initializer lists [Was: Default values for default arguments], Greg Chicares, 2017/02/26
Re: [lmi] () or {} in initializer lists, Vadim Zeitlin, 2017/02/26