4 ms·
Things I would like C to have: - stricter type-checks on typedef types (useful when passing function parameters) - gcc's ' warn_unused_result' attribute for fu
by grok22 6y ago
Things I would like C to have:
- stricter type-checks on typedef types (useful when passing function parameters)
- gcc's ' warn_unused_result' attribute for functions (ensure error returns are checked)
- on-entry/on-exit qualifiers for functions (to do things like make sure you lock/unlock semaphores for instance before entry/exit of function)
- D language's 'scope' feature (better handling of error path)
- loops in the c pre-processor! (better code-gen)
Any chance any of this is on the radar for the next-gen C standard? Some of these are just ergonomics, but the first two might've have saved me some grief a few times.
- _kst_ 6y agotypedef, in spite of the name, doesn't create a new type. It only creates a new name for an existing type. Changing that would break existing code. I wouldn't mind seeing a new feature that does define a new type (one that's identical to, but incompatible with, an existing type), but we can't call it "typedef". In a sense that feature already exists. You can define a structure with a single member of an existing type. But you have to refer to the member by name to do anything with it.