buildaworldnet / IrrlichtBAW

Build A World fork of Irrlicht
http://www.buildaworld.net
Apache License 2.0
122 stars 28 forks source link

Warnings elimination #473

Closed AnastaZIuk closed 3 years ago

AnastaZIuk commented 4 years ago

status:

devshgraphicsprogramming commented 4 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

AnastaZIuk commented 4 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

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

devshgraphicsprogramming commented 4 years ago

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

AnastaZIuk commented 4 years ago

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

devshgraphicsprogramming commented 4 years ago

Update to match the HEAD of shader_pipeline fix my comments and I'll merge

devshgraphicsprogramming commented 3 years ago

closing temporarily.... reopen when ready for merge