Re: RFC - C99 issue regarding unnamed union/structs
In order:toggle quoted messageShow quoted text
1. Empty structs are really useful, for example the spot you're noticing that allows arch code to define its own set of private data, which might be zero-length. Obviously that could be worked around with appropriate preprocessor trickery (e.g. CONFIG_ARCH_HAS_CALLER_SAVED_STRUCT or something similarly wordy), but not as cleanly.
2. That looks wrong. We should surely be using a consistent way to specify packed structs.
3. Flexible arrays are valid C99. You mean a literal zero in the brackets in the declaration? Yeah, that's the wrong syntax, the standard specifies "" for this.
4. That's a "case '1' ... '9':" expression to detect decimal digits in the middle of an otherwise giant switch. Sure, I guess we could turn that into nine separate case labels, but wow is it nicer this way and boy is it a useful feature that the compiler gives us to express this. Hint, hint.
5. Dynamic stack allocation (via either variable arrays or alloca()) is problematic for a various reasons (some dumb, but some good -- note that systemd just got hit by a local root exploit last week due to an attacker-controlled alloca!), and I'm actually the worst offender in the current tree. These are likely all going to have to go away soon, or at least be reworked into a form such that the code will build without dynamic stacks.
On 1/15/2019 12:47 AM, Thomas Törnblom wrote:
While on the subject of language compliance, what about the frequent usage of non-standard gcc extensions that limits portability?