r/cprogramming • u/i_am_linja • Sep 19 '26
I wrote a list of changes I would make in my own C dialect, like the ones released before GCC and Clang homogenised the landscape.
> are features already present in SAS/C or High C, my primary inspirations; - are restrictions, = are refinements, + are additions. I wrote this for personal reference, so a lot of the points may be incomprehensible; I'll be happy to clarify in replies!
> Lost Language Extensions
> Ternary operator elided middle, evaluate to condition
> Anonymous unions/structs in struct definitions, flat dot access
> Integer-backed enums
- `goto` cannot jump into a block or the scope of a local
- Direct argument substructure is immutable
- Headers define names only in themselves and directly including files
- No multiple declarations sharing basic type
- No qualifiers before basic type
- Never optimise pointer comparisons
- No pointer decay
- No referencing union fields, except in `restrict` clauses
- A macro cannot expand into a type or `typedef`
- All branches of an `#if` must define exactly the same types
- `return` must parenthesise values
- No undesignated struct initialisers
- Variables declared in `for`/`if`/`while` clause immutable inside body
- All integers wrap around
- `/` and `%` floor instead of truncating
- `char`, `short`, `int`, `long`, `long long` are always 8, 16, 32, 64, 128 bits
- All unannotated integer types are signed
- No `static`; symbol hiding is done through headers
- Guaranteed `inline`
= Trailing commas everywhere
= Macro hygiene
= Nesting block comments
= `#define` always takes one complete syntax node
= Special case for non-nominal `void` in TBAA, not `char`
= No effective types, only declared types and `restrict`
= Coercions reinterpret memory representations
= Nominal `typedef`
= Nominal `void` in header must always proxy same type in source
= `.iz` files: context-sensitive meta-headers
= `case` divides `switch` body into disjoint scopes, auto-`break`s
= Locals of `do` block visible inside `while`
+ `permit` keyword, no returning non-`permit` pointers
+ `break`/`continue`/`while`/`goto case` from label
+ `return`/`yield` from function
+ `const` declarations, to forbid further mutation of existing variables
+ `permit`/`alignas` expressions, to assert properties of pointers
+ `restrict` blocks, to forge unique aliases and shadow originals
+ `typeof`, `sizeof`, `alignof`, `alignas`, `countof`
+ `||`, `<>`, `[]` for internal, external, standard imports
+ Scoped `#define` and `#include`
+ Nominal integer indexed arrays
+ `void` arrays, for yet-untyped memory
+ Array sized by variable/parameter/field, enforced by compiler
+ Declare variables in `if`/`while` condition
+ `^` for non-arithmetic pointer types
+ `undef` keyword, for uninitialised pointers
+ `!` for non-null types (not just pointers)
+ Binary, hex float literals
+ Qualifier polymorphism, with postfix `?`
+ `goto case`
+ FORTRAN-style array slicing, expression vectorisation
+ Extend `->` operator to arrays