On Thu, 5 Dec 2019 at 22:19, Segher Boessenkool wrote:
> Or you could write
>
> auto __c = (__builtin_memcmp(&*__first1, &*__first2, __len) <=> 0);
> if (__c)
> return __c;
>
> which is much easier to read, to my eyes anyway. And it is exactly the
> same for the compiler.
In this case yes, but not in general.
Given:
auto x = foo();
if (bar(x))
{ }
some_type y;
The destructor of x won't run until after y has been destroyed. That's
not at all identical to:
if (auto x = foo(); bar(x))
{ }
some_type y;
Please don't try to tell me how C++ works :-)