|
|
|
|
|
by flohofwoe
1986 days ago
|
|
Some sort of type inference would make a lot of sense to close some left-over holes from C99: E.g. why does this work: struct bla_t bla = { .x=1, .y=2, .z=3 };
But when I want to assign to an existing variable a "type hint" is needed: bla = (struct bla_t) { .x=1, .y=2, .z=3 };
Why the (struct bla_t)? The compiler knows the type of "bla" after all.Also this would be nice to create a zero-initialized struct value: const struct bla_t bla = {};
...this would basically be a C99 designated initialization without any initializers (it works as a language extension in gcc and clang, but is an error in MSVC). |
|
Another thing - that probably has no resolution - is the struct-tag thingie. Even after all those years I'm not decided if it's worth typedefing structs to remove the struct tag. Like
As almost everybody, for a new language I would not want to have any struct tags. Even though the argument from the Linux Kernel code style guide makes some sense to me ("don't typedef struct tags away because we want to see it's a struct"). Each struct keyword moves the following code 7 columns to the right, which is annoying in lines where there are 3 or more of them.