This question is a little subjective, but I believe it may lead to some constructive answers. Assume I have char x;
and I want to promote it to an integral so I can access it's numeric value. Which should I prefer to use and why? static_cast<int>
or unary arithmetic operator +
?
My own thoughts are that using a static_cast<int>
is more explicit and readable. However, using the unary arithmetic operator +
is shorter code.
Is one way safer than the other?