Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Issue 6271127710072832: No Issue - fix to be conform with std API (Closed)

Created:
June 11, 2015, 12:57 p.m. by sergei
Modified:
June 25, 2015, 10:49 a.m.
Reviewers:
Felix Dahlke
CC:
Oleksandr
Visibility:
Public.

Description

This code does not work with the recent compilers. # works with MSVS 2012

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -1 line) Patch
M shell/src/Main.cpp View 1 chunk +1 line, -1 line 1 comment Download

Messages

Total messages: 6
sergei
June 11, 2015, 1:25 p.m. (2015-06-11 13:25:03 UTC) #1
Felix Dahlke
https://codereview.adblockplus.org/6271127710072832/diff/5629499534213120/shell/src/Main.cpp File shell/src/Main.cpp (right): https://codereview.adblockplus.org/6271127710072832/diff/5629499534213120/shell/src/Main.cpp#newcode39 shell/src/Main.cpp:39: const bool success = std::getline(std::cin, commandLine).good(); Seems standard conform ...
June 17, 2015, 7:06 p.m. (2015-06-17 19:06:52 UTC) #2
sergei
On 2015/06/17 19:06:52, Felix Dahlke wrote: > https://codereview.adblockplus.org/6271127710072832/diff/5629499534213120/shell/src/Main.cpp > File shell/src/Main.cpp (right): > > https://codereview.adblockplus.org/6271127710072832/diff/5629499534213120/shell/src/Main.cpp#newcode39 ...
June 19, 2015, 8:51 a.m. (2015-06-19 08:51:25 UTC) #3
Felix Dahlke
On 2015/06/19 08:51:25, sergei wrote: > On 2015/06/17 19:06:52, Felix Dahlke wrote: > > > ...
June 24, 2015, 1:51 p.m. (2015-06-24 13:51:08 UTC) #4
sergei
On 2015/06/24 13:51:08, Felix Dahlke wrote: > On 2015/06/19 08:51:25, sergei wrote: > > On ...
June 24, 2015, 3:12 p.m. (2015-06-24 15:12:04 UTC) #5
Felix Dahlke
June 24, 2015, 5:55 p.m. (2015-06-24 17:55:34 UTC) #6
On 2015/06/24 15:12:04, sergei wrote:
 > I have checked the code, actually there is 'explicit __CLR_OR_THIS_CALL
operator
> bool() const', however the line still requires editing either to use
> `static_cast<bool>` or `.good()` or `!!` because it's marked as 'explicit'.
> Having that I don't think we should report about it to MS since it's not a
bug,
> it's a feature.

Alright, now I get it - didn't know that `bool b = foo` is not invoking the
explicit conversion operator. Not entirely sure why but it's the same in Clang.
 
> Despite I prefer to always use `!!` (negation of `operator!` result) here I
> would like to call .good() because it looks good semantically and it's not our
> code style (I was told already several times that we don't use `!!` for
> conversion to bool).

Not so sure about that, we use !! a lot in JS at least, and I'm not aware of
anything in our or Mozilla's code style that forbids it for C++. No strong
opinion about that personally.

Anyway, I agree that `good()` looks nice, either is fine by me. LGTM.

Powered by Google App Engine
This is Rietveld