T
Thomas Richter
jacob said:I posted an article about the threading proposal in comp.std.c.
It is basically the documentation of a threading library of
Plauger.
The actual function calls in the library are probably the most harmless
part of threading support.
o The library is an unchanged copy of the C library of 1980. Using
the same software today after 30 years of development (and what a
development) in this field is plain nonsense.
Given the amount of existing code that builds on the existing C library,
replacing it is actually plain nonsense.
Many proposals have
been done to update the C library, specifically to correct the obvious
lack of security and error handling. Yes, the committee got rid of
gets() (could have been done in 1999) and acknowledged the buffer
overflow in the asctime() code, but still, there are a LOT of
functions in the standard library, specially the string handling
functions that are plainly WRONG...
I don't think they're wrong. They require care, care some people forgot.
As for example checking for the proper buffer size. A "strcpy" can be
absolutely correct if you have control on the size of the input string,
and it can be completely fatal if not. If you want to avoid the hassle,
go for C++, or use the limiting functions. "strncpy" is, however, indeed
broken, but it is too late to fix it. There is "strncpy_s" to address this.
How can we keep strtok and be multi-threading at the same time?
You can't. You use strtok_s for that. Breaking *existing* code is *not*
an option.
I did not see any update for multi-threading in the fopen/fclose
and all the functions of the standard library.
Why has fopen() a multithreading issue? It only has if the
implementation is broken???
o There is no standard way of making a list/a tree/ a flexible array/
in C. Everything must be ported, recompiled, etc. I am working in
a proposalfor this, but apparently the committee will decide a
feature freeze next meeting, so I will have to wait till 2020
at least.
Why should there? C is a very small language, and I really don't see the
need for such simple data structures in the standard. If you need
library support for that, and a richer structure that helps you with
such containers, use C++ and the STL. This is what it has been designed for.
So long,
Thomas