Why does UE4 use uint32 to represent a bool?

Why does UE4 use uint32 to represent a bool? What’s the advantage of using uint32 vs bool?

i think you’ll find they use bitfields alot and the uint32 is used in the bitfield to ensure alignment boundries. it helps make the memory faster to access because its aligned.

I made a post on SO

You should not add unreal code (this is engine code and not your sample code) to a public forum, you might violate the license agreement.

Now to the questio ^^. Using a bit field saves you a lot of runtime memory, the same can be achieved using a union like:

IANAL, but I believe you are allowed to post up to 30 lines.

and network bandwidth.

It doesn’t, it just affects how they’re stored. How you pack them in your bit stream is unrelated, you could pack a boolean (8-bit) as 1-bit on the network stream.

Ah thats nice :smiley: Good to know when posting samples :smiley: