google / google/flatbuffers

Question about the choice of padding fields

Open
#9,151 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
26.5k
Forks
3.7k
PR merge metrics
No merged PRs in 30d

Description

I noticed that FlatBuffers generates padding for c/cpp as individual fields, e.g.:

uint8_t padding0__;
uint8_t padding1__;
uint8_t padding2__;

instead of a single array:

uint8_t padding__[3];

I understand why FlatBuffers generates explicit padding and manually controls struct layout, but I couldn't find any documentation explaining the choice of individual padding fields versus arrays.

Was this a deliberate design decision? If so, what were the motivations?

Contributor guide

Open the contributing guide

Research direction

The issue identifies generated C/C++ padding fields but names no source file or test. Review the code-generation output and existing documentation to determine whether the individual-field choice has a documented rationale; done means adding a clear explanation if the project confirms one.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cpp
Domain
tooling
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.