New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removed C style arrays from the BlockEntity folder #4979
base: master
Are you sure you want to change the base?
Conversation
hello again, welcome back! |
Now it should compile... This journey will cause a lot of |
Could you change BrewingstandEntity::GetResultItem, SignEntity::Get/SetLine to size_t? |
Of course I can. Just didn't do it, to not to break/change too many files. I would also change |
Sure do it |
Hey @bibo38 you still working on this? |
I've stopped after reworking the whole |
@tigerw Or did you started with some major work in your continuation PR? |
Nothing major, I say add what you have here, I don't mind a large list of changes :) |
I just want to prevent the scenario that happened to #4226. Better getting a bunch of small changes into master which are quick to check. |
How big are the changes when you use size_t for item grids? If you have something ready just push. By the way, is it worth using std array absolutely everywhere? Compared to a native language feature (C arrays) the templates will have more of an impact on compile times, no? |
They were really big with the whole
Looking at the (compilation) speed is a preliminary optimization. Unless someone benchmarks a significant speed impact, it isn't worth to optimize, as these optimizations take their price:
Also C++ limits the compilation speed, as it needs to be backwards compatible to C89 and C++98 (otherwise they could've just replaced C-Arrays), so most of the new stuff is added as a template, as these constructs may also be used to port functionality back to older standards. Changing the whole project to C would probably speed up the compilation more than all C++ optimizations combined. Or one could just code everything in Python, Javascript or Lua and only write the performance bottlenecks in C or similar, which gives nearly zero compilation time P.S.: I also wouldn't really expect that much of a slowdown, as the header for |
As STL-Containers want to use unsigned indexes it is better to migrate everything to size_t in the long run to avoid static_cast's. Signed integers may still be used for special indexes, which may have some special values, e.g. -1 if no index was found. This has the benefit that the compiler will throw an error, if somebody always valid indexes and indexes that may have a special value, as both distinguish in the signedness.
Just pushed my current state... Some Lua stuff seems to go crazy. I've to investigate if this is caused by the overloading (probably) or by the changes to the bindings. |
You might need a cLuaState::Push overload for size_t. |
also thanks for the rundown on std::array, agreed any impact is probably negligible. |
Reworking #4226 and splitting into multiple PRs
Related to #1401