<html>
<head>
<base href="https://bugs.documentfoundation.org/">
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Don't use static_cast with numeric literals"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=131117#c2">Comment # 2</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Don't use static_cast with numeric literals"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=131117">bug 131117</a>
from <span class="vcard"><a class="email" href="mailto:sbergman@redhat.com" title="Stephan Bergmann <sbergman@redhat.com>"> <span class="fn">Stephan Bergmann</span></a>
</span></b>
<pre>(In reply to Mike Kaganski from <a href="show_bug.cgi?id=131117#c0">comment #0</a>)
<span class="quote">> I suppose this is not a correct semantically, since static_cast is to cast
> some existing value of a different type into wanted other type; while when
> literals are involved, what happens is *creation* of a new value of
> specified type. In my opinion, it's better to use function-style
> (ctor-style) cast syntax here, like `wanted_type(literal)`.</span >
Semantically, both static_cast and functional cast are fine there, and have the
exact same meaning. Syntactically, functional cast can only be used if
wanted_type is a simple-type-specifier (e.g., it cannot be used if wanted_type
is "unsigned long"). Apart from that, I at least have no clear preference for
either (functional cast is less verbose, though), and am not sure whether such
a cosmetic clean-up is worth it and wanted.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>