Comment by flohofwoe

1 month ago

C99 ;) ...compared to 'popular C' (which is essentially C89 plus some common extensions taken from early C++) C99's main improvements (designated initialization and compound literals) haven't really caught on yet even among many C programmers, but those features (IMHO) completely revolutionize the language, and especially library API design.

Also on a more serious note: I started some projects in Zig and even though most of my future projects will be built on a bedrock of C code, more and more of the top-level layers will happen in Zig.

There it is again, the urge to port my Lisp back to C.

https://github.com/codr7/eli

What I love most about C is the fact that it doesn't talk down to me no matter what crazy ideas I come up with. It's therapeutic for me, reminds me why I started writing code in the first place.

I realize that's also what many hate about it, the fact that it gives other people freedoms they would never trust themselves with.

Designated initialisers and compound literals, sure they have caught on, one just has to know where to look:

    https://github.com/danos/vyatta-dataplane/blob/master/src/npf/config/gpc_hw.c#L600-L623

    https://github.com/danos/vyatta-dataplane/blob/master/src/npf/config/npf_rule_group.c#L252-L280

That is code which is around 4 years old.

For the latter example, one could theoretically avoid declaring the variables 'event' an 'rg_match', instead direcly including the compound literals in the respective function calls. However it is a question of taste, and what is more readable.

(The above have designated initialisers, I'm can't remember if there are any compound literal examples there.

There is however one here, when the BSTR_K macro is also expanded, also the earlier BSTR_INIT:

    https://github.com/danos/vyatta-dataplane/blob/master/src/npf/bstr.h#L199