Earlier quoted context omitted.
No one has proposed making these standard. I doubt they would gain much support as they are similar to the Annex K Bounds Checked Interface functions strcpy_s and strcat_s but not quite as good IMHO.
There were a number of recent proposals to adopt various POSIX functions by Martin Sebor into C including: N2353 2019/03/17 Sebor, Add strdup and strndup to C2X N2352 2019/03/17 Sebor, Add stpcpy, and stpncpy to C2X N2351 2019/03/17 Sebor, Add strnlen to C2X He is lurking on this thread as well. These proposals can all be found in the document log at http://www.open-std.org/jtc1/sc22/wg14/www/wg14_document_log...
Tell HN: C Experts Panel – Ask us anything about C
61–70 of 978 posts
Re: Tell HN: C Experts Panel – Ask us anything about C
#62I do find that C is difficult use for large programs. It there any thoughts that introducing features like namespaces. Another thing very cumbersome is to do in C is object creation; creating instantiable objects is possible very cumbersome. Is there some feature in the thoughy process to deal with it. To make it clear, in C we can create a data structure like a Stack or a queue easily. But if the program needs 10 st…
To minimize the external identifiers, one could make just the name of a container structure the sole entry access handle, with structure members pointing to the functions. Then use it like:
#include
if ((new = Mm.allo(size)) == NULL)
Er.abort("out of memory");Re: Tell HN: C Experts Panel – Ask us anything about C
#63Earlier quoted context omitted.
No one has proposed making these standard. I doubt they would gain much support as they are similar to the Annex K Bounds Checked Interface functions strcpy_s and strcat_s but not quite as good IMHO.
> similar to the Annex K Bounds Checked Interface functions strcpy_s and strcat_s but not quite as good IMHO. Err... I thought Annex K is deprecated and dead? Whereas strl* seem very much alive, some compilers even give a "strcpy/strncpy is unsafe, use strlcpy instead" warning.
Re: Tell HN: C Experts Panel – Ask us anything about C
#64I'd love your opinion on the abundance of "undefined behaviour" (as opposed to implementation-defined, or some new incantation such as "unknown result in variable but system is safe") for relatively trivial things such as signed (but not unsigned) integer overflows. I've heard that this is to allow for non-twos-complement implementations. However, in practice, you notice that most people use ugly workarounds which le…
> (because of e.g. casting to unsigned and allowing the same overflow to happen anyway) only work correctly on twos-complement anyway Unsigned arithmetic never overflows, and guarantees two's-complement behavior, because unsigned arithmetic is always carried out modulo 2^n: > A computation involving unsigned operands can never overflow, because a result that cannot be represented by the resulting unsigned integer typ…
Re: Tell HN: C Experts Panel – Ask us anything about C
#65Is there a rule that any new proposals must already be a feature in an existing major implementation?
Yes, the C2x charter has this requirement: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2086.htm
Re: Tell HN: C Experts Panel – Ask us anything about C
#66Some hints on what I'm referring to can be found here: https://github.com/mpv-player/mpv/commit/1e70e82baa9193f6f02...
Unrelated, but I also miss a binary constant notation (such as 0b10101)
Re: Tell HN: C Experts Panel – Ask us anything about C
#67Quite a few new languages generate C code for the “backend” of their compiler. For example ATS and the ZZ language. This helps bringing these languages to embedded targets with closed toolchains (with an existing C compiler). Will there be developments to use a subset of C as a “portable assembly” in a standard way? Like there is WebAssembly for JavaScript.
Re: Tell HN: C Experts Panel – Ask us anything about C
#68* Why can't the learning curve be solved using tools? * Why don't we actively promote more higher level languages which are implemented in C (by fewer people)?
Re: Tell HN: C Experts Panel – Ask us anything about C
#69Earlier quoted context omitted.
> similar to the Annex K Bounds Checked Interface functions strcpy_s and strcat_s but not quite as good IMHO. Err... I thought Annex K is deprecated and dead? Whereas strl* seem very much alive, some compilers even give a "strcpy/strncpy is unsafe, use strlcpy instead" warning.
FWIW, Annex K is not currently deprecated.