(no title)
wolfspaw | 1 year ago
Array pointers: Array to pointer decay is extremely annoying, if it was implemented as Array to "slice" decay it would be great.
Static array indices in function parameter declarations: awesome, a shame that C++ (and Tiny C) do not support it >/
flexible array member: extremely useful, and now there are good compiler flags for ensuring correct flexible array member usage
X-Macro: nice, no-overhead enum to string name. Didn't know the trick
Combining default, named and positional arguments: Named-arguments/default-arg, C version xD. It would be cool if it was added to C language as a native feature, instead of having to do the struct hiding macro.
Comma operator: really useful, specially in macros
Digraphs, trigraphs and alternative tokens: di/tri/graphs rarely useful, alternatives synonims of iso646.h are awesome, love using and/or instead of &&/||
Designated initializer: super awesome, could not use if you wanted C++ portability. Now C++ supports some part of it.
Compound literals: fantastic, but in C++ it will explode due to stack deallocation in the same line. C++ should fix this and allow the C idiom >/
Bit fields: nice for more control of structs layout
constant string concat: "MultiLine" String, C version xD
Ad hoc struct declaration in the return type of a function: didn't know this trick, "multi value" return, C version xD
Cosmopolitan-libc: incredible project. Already knew of it, its awesome to offer a binary that runs in all S.Os at the same time.
Evaluate sizeof at compile time by causing duplicate case error: ha, nice trick for debugging the size of anything.
WalterBright|1 year ago
It's not just annoying, it's the major source of bugs in shipped code. A fix:
https://www.digitalmars.com/articles/C-biggest-mistake.html
wolfspaw|1 year ago
(In fact, I already had your article bookmarked xD, and I’m familiar with and truly admire your work)
fuhsnn|1 year ago
The first array size is actually always decayed to a pointer, supporting it in a compiler without analysis passes like TCC is just a matter of skipping the "static" token and the size.
jcelerier|1 year ago
C++ does?
will fail at compile time if you pass it anything other than an int[5] arraymananaysiempre|1 year ago
xeyownt|1 year ago
It is what allows to do int * p = arr, and looping on array element with p++.
Keeping array type you would jump beyond the last element at first iteration.
kaba0|1 year ago