Closed JanX2 closed 1 year ago
Yup, given the code it won't matter but I like best practices. Can you use nmbs_bitfield_reset()
? And can you format the code with the provided .clang-format
?. Thank you
nmbs_bitfield_reset()
does not work with globals. Took me a while to figure out why the macro was failing to compile in some of the sample code. Any suggestions? Fall back to = {0}
?
Edit: scratch that. The globals and declarations should be initialized with = {0}
so nmbs_bitfield_reset()
would be superfluous. nmbs_bitfield_reset()
only really makes sense, when we want to set a bitfield back to 0. Am I missing something?
Yes, ={0}
should be fine, 1 line is better than 2 anyway.
But why do you say nmbs_bitfield_reset()
doesn't work? It tried something like this:
nmbs_bitfield a;
int main() {
nmbs_bitfield_reset(a);
}
and it compiles as expected.
Just realized I missed your edit. Well then, it think this can be closed. Thank you
Yes,
={0}
should be fine, 1 line is better than 2 anyway. But why do you saynmbs_bitfield_reset()
doesn't work? It tried something like this:nmbs_bitfield a; int main() { nmbs_bitfield_reset(a); }
and it compiles as expected.
Yes. But this won’t:
nmbs_bitfield a;
nmbs_bitfield_reset(a);
int main() {
return 0;
}
Do you have any thoughts on this? Better safe than sorry.