splash-damage/coding-standards

Question: bit sets

Lawendt opened this issue · 1 comments

This comment got me curious (from here)

	// illustration purpose only - don't do this in live code (use bit sets instead of many bool's)
	const bool FailCondition = false, TrueCondition = true,
		SomethingElse = true, Contract = true, Binding = true;

What is meant by bit sets? I did some research on this term for unreal and I'm failing to see any relevant information for that. Found TBitArray but I'm not sure if that's what this is referring to. I believe is not referring to bitflags as well.
Does anyone have any information on that? Thank you.

I suspect this actually means to refer to bit fields, i.e. https://en.cppreference.com/w/cpp/language/bit_field

For local variables, bools are fine, but for better packing within allocated memory, bit fields are handy to make better use of space without having to do manual bit fiddling operations.