You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm just wondering if there is any reason why not use the auto keyword of C++? It's been there since C++11 and our code base can compile C++17 if I'm not mistaken.
In some parts of code, instead of typing: const VoxelLightSpreader::OutputBlock &out_block = output.blocks[i];
One would just do: auto &out_block = output.blocks[i];
I'm asking it before using auto because we should have some kind of "code convention" IHMO.
Thanks!
The text was updated successfully, but these errors were encountered:
So far I've been following similar conventions to those of Godot itself, but since I openly use C++11 features in some places, it's a bit more relaxed (mostly because Godot equivalents are inadapted). I'm not a fan of auto, especially when the type cannot be deduced by solely looking at the line (like your example). So I would suggest to not use it for long term readability, unless it's a horrible one like STL iterators or lambdas with multiple templates in it. In other situations I preferred typedef (Like Mgr in updater and streamer).
Got it. To be honest, I don't see a problem when using auto, since whenever we are developing C++ we use a IDE, which quick shows us the variable type and, in most cases, you don't really care for the type, since generally you receive it from a function or struct/class members whose the type was already declared someplace else.
When declaring I may agree, since auto i = 0 may sound ambiguous between int and unsigned int.
But anyway, I'll keep not using auto keyword, since most time of my development should be on GDScript, so this shound'nt be a problem.
Hello folks!
I'm just wondering if there is any reason why not use the
auto
keyword of C++? It's been there since C++11 and our code base can compile C++17 if I'm not mistaken.In some parts of code, instead of typing:
const VoxelLightSpreader::OutputBlock &out_block = output.blocks[i];
One would just do:
auto &out_block = output.blocks[i];
I'm asking it before using
auto
because we should have some kind of "code convention" IHMO.Thanks!
The text was updated successfully, but these errors were encountered: