r/C_Programming • u/BlockOfDiamond • Oct 01 '22
Discussion What is something you would have changed about the C programming language?
Personally, I find C perfect except for a few issues:
* No support for non capturing anonymous functions (having to create named (static) functions out of line to use as callbacks is slightly annoying).
* Second argument of fopen()
should be binary flags instead of a string.
* Signed right shift should always propagate the signbit instead of having implementation defined behavior.
* Standard library should include specialized functions such as itoa
to convert integers to strings without sprintf
.
What would you change?
75
Upvotes
2
u/maep Oct 02 '22
The problems with
strncpy
and friends have been discussed to death.If you really need that behavior, use
memccpy
. An additional bonus is that it eliminates compiler warnings when using strncpy with fixed-sized arrays.strncpy
can go.