[Libreoffice-bugs] [Bug 131117] Don't use static_cast with numeric literals
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Wed Mar 4 12:27:17 UTC 2020
https://bugs.documentfoundation.org/show_bug.cgi?id=131117
--- Comment #2 from Stephan Bergmann <sbergman at redhat.com> ---
(In reply to Mike Kaganski from comment #0)
> 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)`.
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.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20200304/b05da868/attachment.htm>
More information about the Libreoffice-bugs
mailing list