-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Quesiton with state to state10. #2
Comments
I don’t really think that’s really relevant in this use case, I mean, sure you might be saving a bit of memory, but that’s on pretty temporary code (I believe), and that’s really not much on a desktop PC. However, there is a much more important reason why you don’t want to do that : since ImGui will be taking your parameter by pointer (and assumes a |
No need for optimizing that. I get that coming from embedded it might look fast and loose, but it won't be worthwhile to optimize everything as we go along. Later on when there is a more significant code base, then we can profile and see which things really need optimizing. This isn't an excuse for poor architecture, but yeah, even I thought it would just even look cleaner and be faster to write an array (C array, nothing fancy) than typing them all out. Your understanding is correct though, if we were indeed out to optimize memory then that would potentially be a way to go. |
If you want a collection of flags there is |
Hello, I am coming from embedded C, I just started learning C++, so maybe this question is going far ahead or even sound stupid to veteran C++ devs. I know that the purpose of the checkbox is to see the progress of the weekly episodes so it is a pretty simple solution to do that but, if we would like to optimize the solution, does the following make sense:
If I understand properly the bool type is taking up a byte in the memory.
If we would like to optimize from the side of memory, would it be better to use bit fields(i am not sure if this is the way to go with C++20), or bitsets/dynamic_bitsets. But yes this would have to be casted into a bool.
Example:
typedef struct t
{
uint16_t State:1;
uint16_t State1:1;
uint16_t State2:1;
uint16_t State3:1;
uint16_t State4:1;
uint16_t State5:1;
uint16_t State6:1;
uint16_t State7:1;
uint16_t State8:1;
uint16_t State9:1;
uint16_t State10:1;
}CheckBox_Status;
Thank you for doing this tutorial series.
The text was updated successfully, but these errors were encountered: