Talk:New coding guidelines

From Multi Theft Auto: Wiki
Revision as of 18:57, 25 June 2024 by Tracer (talk | contribs) (→‎auto vs auto*: new section)
Jump to navigation Jump to search

auto vs auto*

When you use static_cast, wouldn't it be better to use auto instead of auto*?

auto* obj = static_cast<Class*>(object);
// vs
auto obj = static_cast<Class*>(object);

It would have the same result. Yes, * marks the variable as a pointer but from the cast we can see that it is a pointer nonetheless.

-- Tracer (talk) 18:57, 25 June 2024 (UTC)