Closed AnastaZIuk closed 3 years ago
Prefer static_cast<T>(var)
to C-style cast (T)var
, C-style cast will cast anything to anything pretty much !
careful with decltype(variable)
especially with regards to ints, and similar, because decltype(var)
on something that was declared as T var
actually evaluates to T&
or const T&
(depending on current scope's access const qualifiers), and you really dont want to be casting constant literals to references (this ties into why you want to use static_cast
and not C-style cast).
You'd actually need a std::decay for that... ask @Crisspl how to best handle
Prefer
static_cast<T>(var)
to C-style cast(T)var
, C-style cast will cast anything to anything pretty much !careful with
decltype(variable)
especially with regards to ints, and similar, becausedecltype(var)
on something that was declared asT var
actually evaluates toT&
orconst T&
(depending on current scope's access const qualifiers), and you really dont want to be casting constant literals to references (this ties into why you want to usestatic_cast
and not C-style cast).You'd actually need a std::decay for that... ask @Crisspl how to best handle
I need to change for static_cast
, but I find it probably not true (quite) with evaluating to T&
or const T&
, since it depends on the way you call decltype
I need to change for static_cast, but I find it probably not true (quite) with evaluating to T& or const T&, since it depends on the way you call decltype
I think static_cast<decltype()>
should protect us against most things
I need to change for static_cast, but I find it probably not true (quite) with evaluating to T& or const T&, since it depends on the way you call decltype
I think
static_cast<decltype()>
should protect us against most things
yeah, it's true
Update to match the HEAD of shader_pipeline
fix my comments and I'll merge
closing temporarily.... reopen when ready for merge
status: