<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Can we get at least a summary of any decisions made before action
is taken? I'm definitely not reading this thread in detail and I
doubt others are either.</p>
<p>Philip<br>
</p>
<div class="moz-cite-prefix">On 01/09/2017 10:16 AM, David Blaikie
via llvm-dev wrote:<br>
</div>
<blockquote
cite="mid:CAENS6EufJXnuVjVfGuYSECEjHYpsdx0tpU3dirVQAi==2Yhofg@mail.gmail.com"
type="cite">
<div dir="ltr"><br class="gmail_msg">
<br class="gmail_msg">
<div class="gmail_quote gmail_msg">
<div dir="ltr" class="gmail_msg">On Mon, Jan 9, 2017 at 10:10
AM Piotr Padlewski <<a moz-do-not-send="true"
href="mailto:piotr.padlewski@gmail.com" class="gmail_msg"
target="_blank">piotr.padlewski@gmail.com</a>> wrote:<br
class="gmail_msg">
</div>
<blockquote class="gmail_quote gmail_msg" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr" class="gmail_msg">
<div class="gmail_extra gmail_msg">
<div class="gmail_quote gmail_msg">2017-01-09 17:24
GMT+01:00 David Blaikie <span dir="ltr"
class="gmail_msg"><<a moz-do-not-send="true"
href="mailto:dblaikie@gmail.com" class="gmail_msg"
target="_blank">dblaikie@gmail.com</a>></span>:<br
class="gmail_msg">
<blockquote class="gmail_quote gmail_msg"
style="margin:0px 0px 0px 0.8ex;border-left:1px
solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr" class="gmail_msg"><br
class="gmail_msg">
<br class="gmail_msg">
<div class="gmail_quote gmail_msg"><span
class="m_-964398813434624145m_-1212777871862749204gmail-
gmail_msg">
<div dir="ltr" class="gmail_msg">On Mon, Jan
9, 2017 at 6:17 AM Piotr Padlewski via
cfe-dev <<a moz-do-not-send="true"
href="mailto:cfe-dev@lists.llvm.org"
class="gmail_msg" target="_blank">cfe-dev@lists.llvm.org</a>>
wrote:<br class="gmail_msg">
</div>
<blockquote class="gmail_quote gmail_msg"
style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div dir="ltr"
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">Are there any other comments
about changing style guide?
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">I would like to add points
like</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">- prefer "using' instead of
"typedef"</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">- use default member
initialization</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">struct A {</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"> void *ptr = nullptr;</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">};</div>
</div>
</blockquote>
<blockquote class="gmail_quote gmail_msg"
style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div dir="ltr"
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">(instead of doing it in
constructor)</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">- use default, override,
delete</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">- skip "virtual" with
override</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">The last point is to get to
consensus with </div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">push_back({first, second}) </div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">or</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">emplace_back(first ,second);</div>
</div>
</blockquote>
</span>
<div class="gmail_msg"><br class="gmail_msg">
<br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605inbox-inbox-Apple-interchange-newline
gmail_msg">
It might be a bit noisy, but I'd be inclined
to start a separate thread for each of these
on llvm-dev with a clear subject line relevant
to each one. So they don't get lost and some
of them don't get drowned out by the
discussion of others, etc.<br
class="gmail_msg">
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
<div dir="ltr" class="gmail_msg">
<div class="gmail_extra gmail_msg">
<div class="gmail_quote gmail_msg">
<div class="gmail_msg">Sure, I can do it, but at least
now I don't see much of attention of people to any
of the subject, so I would not like to start 5 empty
threads.</div>
<div class="gmail_msg">I guess as long as the thread
is not getting noisy I will keep only one. Does it
sound ok?</div>
</div>
</div>
</div>
</blockquote>
<div><br>
Perhaps - if no one else pipes up *shrug*<br>
<br>
If that's the case, I'd at least suggest submitting the
changes to the style guide separately with clear
subject/titles so people reading commits might
see/notice/discuss there.<br>
<br>
FWIW: I'm also in favor of push_back where valid. Though I'm
not sure it's so much a matter of votes, but justification,
etc. As for the others - sure, they all sound good to me.<br>
<br>
Also - once these are in the style guide there's still a
separate discussion to be had about whether automated
cleanup is worthwhile & how best to go about that sort
of thing.<br>
</div>
<blockquote class="gmail_quote gmail_msg" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr" class="gmail_msg">
<div class="gmail_extra gmail_msg">
<div class="gmail_quote gmail_msg">
<div class="gmail_msg"><br class="gmail_msg">
</div>
<div class="gmail_msg"> </div>
<blockquote class="gmail_quote gmail_msg"
style="margin:0px 0px 0px 0.8ex;border-left:1px
solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr" class="gmail_msg">
<div class="gmail_quote gmail_msg">
<blockquote class="gmail_quote gmail_msg"
style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div class="gmail_msg">
<div
class="m_-964398813434624145m_-1212777871862749204gmail-h5
gmail_msg">
<div class="gmail_extra
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
<div class="gmail_quote
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">2016-12-30 12:26 GMT+01:00
Piotr Padlewski <span dir="ltr"
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><<a
moz-do-not-send="true"
href="mailto:piotr.padlewski@gmail.com"
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg" target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:piotr.padlewski@gmail.com">piotr.padlewski@gmail.com</a></a>></span>:<br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
<blockquote class="gmail_quote
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div dir="ltr"
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
<div class="gmail_extra
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
<div class="gmail_quote
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><span
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">2016-12-30 11:34
GMT+01:00 Chandler Carruth <span
dir="ltr"
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><<a
moz-do-not-send="true"
href="mailto:chandlerc@gmail.com"
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"
target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:chandlerc@gmail.com">chandlerc@gmail.com</a></a>></span>:<br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
<blockquote
class="gmail_quote
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"
style="margin:0px 0px 0px
0.8ex;border-left:1px
solid
rgb(204,204,204);padding-left:1ex">
<div dir="ltr"
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
<div class="gmail_quote
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><span
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125m_-4391909161219543446gmail-
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
<div dir="ltr"
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">On Fri,
Dec 30, 2016 at
2:08 AM Piotr
Padlewski via
cfe-dev <<a
moz-do-not-send="true"
href="mailto:cfe-dev@lists.llvm.org"
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"
target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a></a>>
wrote:<br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<blockquote
class="gmail_quote
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"
style="margin:0px
0px 0px
0.8ex;border-left:1px
solid
rgb(204,204,204);padding-left:1ex">
<div dir="ltr"
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125m_-4391909161219543446gmail-m_-7306051220478311565gmail_msg
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">Thanks
for very
accurate
responses.
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125m_-4391909161219543446gmail-m_-7306051220478311565gmail_msg
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">- I
totally agree
what Dave and
Chandler said
about explicit
and implicit
operations,
this is what I
meant my first
email.</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125m_-4391909161219543446gmail-m_-7306051220478311565gmail_msg
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"> I
believe there
are places
like </div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125m_-4391909161219543446gmail-m_-7306051220478311565gmail_msg
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
v.emplace_back(A, B);</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125m_-4391909161219543446gmail-m_-7306051220478311565gmail_msg
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
istead of</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125m_-4391909161219543446gmail-m_-7306051220478311565gmail_msg
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
v.push_back(make_pair(A, B));b</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125m_-4391909161219543446gmail-m_-7306051220478311565gmail_msg
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
That can make
code simpler.</div>
</div>
</blockquote>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
</span>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">Do you
have examples? The
only ones i can come
up with are the ones
where the push_back
variant literally
can't compile
because the type
isn't movable.</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">Perhaps
it would be useful
to break down
categories of can
happen here...</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">Case 1:
there is one object
already -- this is a
*conversion* of a
type.</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">- If the
author of the
conversion made it
*implicit*, then
'v.push_back(x)'
just works.</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">- If the
author of the
conversion made it
*explicit* I would
like to see the name
of the type
explicitly:
'v.push_back(T(x))'.</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
</div>
</div>
</blockquote>
<blockquote
class="gmail_quote
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"
style="margin:0px 0px 0px
0.8ex;border-left:1px
solid
rgb(204,204,204);padding-left:1ex">
<div dir="ltr"
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
<div class="gmail_quote
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">Case 2a:
There is a
collection of
objects that are
being composed into
an aggregate. We
don't have any
interesting logic in
the constructor, it
takes an initializer
list.</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">- This
should work with
'v.push_back({a, b,
c})'</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">- If it
doesn't today, we
can fix the type's
constructors so that
it does.</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">- Using
'emplace_back'
doesn't help much --
you still need {}s
to form the
std::initializer_list
in many cases. Pair
and tuple are
somewhat unusual in
not requiring them.</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
</div>
</div>
</blockquote>
</span>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"> This sounds
extremely reasonable. </div>
<span
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
<blockquote
class="gmail_quote
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"
style="margin:0px 0px 0px
0.8ex;border-left:1px
solid
rgb(204,204,204);padding-left:1ex">
<div dir="ltr"
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
<div class="gmail_quote
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">Case 2b:
A specific
constructor needs to
be called with an
argument list. These
arguments are not
merely being
aggregated but are
inputs to a
constructor that
contains logic.</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">- This is
analogous to a case
called out w.r.t.
'{...}' syntax in
the coding
standards[1]</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">- Similar
to that rule, I
would like to see a
*call to the
constructor* rather
than hiding it
behind
'emplace_back' as
this is a function
with interesting
logic.</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">- That
means i would write
T(a, b, c) anyways,
and
'v.push_back(T(a, b,
c))' works.</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
</div>
</div>
</blockquote>
</span>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">Calling
emplace_back with 0 or
multiple arguments is a
clear way of saying "this
constructor takes multiple
arguments".</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">We can do it with
initializer list with easy
way like:</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><font
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"
face="monospace,
monospace">v.emplace_back()
== v.push_back({})</font></div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><font
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"
face="monospace,
monospace">v.emplace_back(a,
b ,c) == v.push_back({a,
b, c})</font></div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">I personally
never liked the initializer
syntax because of tricky
casees like:</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><font
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"
face="monospace,
monospace">vector<string>
v{{"abc", "def"}};</font><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">Which is
equivalent of </div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><font
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"
face="monospace,
monospace">vector<string>
v = {std::string("abc",
"def")};</font><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">That will call
std::string ctor with 2
iterators likely crashing,
and putting same string
might gives us empty string.</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">In this case
programmer probably meant</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><font
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"
face="monospace,
monospace">std::vector<std:string>
v({"abc", "def"});</font><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">or</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><font
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"
face="monospace,
monospace">std::vector<std::string>
v = {"abc", "def"};</font><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">But this case is
not possible to mess up with
push_back (in the case of
vector<vector<string>>
or something). At least I
hope it is not.</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">So avoiding
braces is my personal
preference. It is fine for
me if we would choose to
prefer '<font
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"
face="monospace,
monospace">v.push_back({a,
b, c})</font>' instead of
'<font
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"
face="monospace,
monospace">v.emplace_back(a,
b, c)</font>', ofc as long
as most of the community
would prefer first form to
the second :)</div>
<span
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<blockquote
class="gmail_quote
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"
style="margin:0px 0px 0px
0.8ex;border-left:1px
solid
rgb(204,204,204);padding-left:1ex">
<div dir="ltr"
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
<div class="gmail_quote
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">[1]: <a
moz-do-not-send="true"
href="http://llvm.org/docs/CodingStandards.html#do-not-use-braced-initializer-lists-to-call-a-constructor"
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"
target="_blank"><a class="moz-txt-link-freetext" href="http://llvm.org/docs/CodingStandards.html#do-not-use-braced-initializer-lists-to-call-a-constructor">http://llvm.org/docs/CodingStandards.html#do-not-use-braced-initializer-lists-to-call-a-constructor</a></a></div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">Case 3:
Passing objects of
type 'T' through
'push_back' fails to
compile because they
cannot be copied or
moved.</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">- You
*must* use
'emplace_back' here.
No argument
(obviously).</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">My
experience with LLVM
code and other
codebases is that
case 3 should be
extremely rare. The
intersection of
"types that cannot
be moved or copied"
and "types that you
put into containers"
is typically small.</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">Anyways,
I don't disagree
with this point with
a tiny fix:</div>
<span
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125m_-4391909161219543446gmail-
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
<blockquote
class="gmail_quote
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"
style="margin:0px
0px 0px
0.8ex;border-left:1px
solid
rgb(204,204,204);padding-left:1ex">
<div dir="ltr"
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125m_-4391909161219543446gmail-m_-7306051220478311565gmail_msg
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125m_-4391909161219543446gmail-m_-7306051220478311565gmail_msg
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"> I
think in cases
like this we
can leave it
for judgement
of
contributor.</div>
</div>
</blockquote>
</span>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">*or
reviewer*. ;]</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
<div
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">I
continue to think
exceptions can be
made in rare cases
when folks have good
reasons. But I
expect this to be
quite rare. =]</div>
</div>
</div>
</blockquote>
</span></div>
<span
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125HOEnZb
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><font
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg" color="#888888"><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</font></span></div>
<span
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125HOEnZb
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg"><font
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg" color="#888888">
<div class="gmail_extra
m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">Piotr</div>
</font></span></div>
</blockquote>
</div>
<br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</div>
</div>
</div>
<span
class="m_-964398813434624145m_-1212777871862749204gmail-
gmail_msg">
_______________________________________________<br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
cfe-dev mailing list<br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
<a moz-do-not-send="true"
href="mailto:cfe-dev@lists.llvm.org"
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg" target="_blank">cfe-dev@lists.llvm.org</a><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
<a moz-do-not-send="true"
href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev"
rel="noreferrer"
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br
class="m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg
gmail_msg">
</span></blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
<br>
</body>
</html>