> One of the concerns is that C and C++ are being discouraged for new projects by several branches of the US government[1], which makes memory safety important to address. The biggest memory safety problem for C is array overflows. I proposed a simple, backwards compatible change to C years ago, and it has received zero traction. Note that we have 20 years of experience in D of how well it works. https://www.digitalm…
Soursop and Ponies in Kona: A C++ Committee Trip Report
51–60 of 69 posts
Re: Soursop and Ponies in Kona: A C++ Committee Trip Report
#52This can be done by compilers without any change to the language standard.
Re: Soursop and Ponies in Kona: A C++ Committee Trip Report
#53Isn’t this a damming indictment of the language and everything that is wrong with it? How can something so simple be so hard?
Re: Soursop and Ponies in Kona: A C++ Committee Trip Report
#54> One of the concerns is that C and C++ are being discouraged for new projects by several branches of the US government[1], which makes memory safety important to address. The biggest memory safety problem for C is array overflows. I proposed a simple, backwards compatible change to C years ago, and it has received zero traction. Note that we have 20 years of experience in D of how well it works. https://www.digitalm…
C++ already has vector and now has span. Your proposal doesn't add anything over those.
1. convenience
2. attractive appearance
3. ubiquity
4. better error messages (because compiler knows what they are)
5. one construct instead of two (vector and span)
6. overflow behavior selectable with compiler switch
For example:
#include
std::vector v;
vs: int[] v;
Many D users have remarked that it's the single best feature of D.Re: Soursop and Ponies in Kona: A C++ Committee Trip Report
#55> One of the concerns is that C and C++ are being discouraged for new projects by several branches of the US government[1], which makes memory safety important to address. The biggest memory safety problem for C is array overflows. I proposed a simple, backwards compatible change to C years ago, and it has received zero traction. Note that we have 20 years of experience in D of how well it works. https://www.digitalm…
C++ already has vector and now has span. Your proposal doesn't add anything over those.
C has no such thing that I am aware of
Re: Soursop and Ponies in Kona: A C++ Committee Trip Report
#56Herb's CppFront looks like the best hope for a clean C++ future
Re: Soursop and Ponies in Kona: A C++ Committee Trip Report
#57> One of the concerns is that C and C++ are being discouraged for new projects by several branches of the US government[1], which makes memory safety important to address. The biggest memory safety problem for C is array overflows. I proposed a simple, backwards compatible change to C years ago, and it has received zero traction. Note that we have 20 years of experience in D of how well it works. https://www.digitalm…
Using an ifdef to maintain source level compatibility doesn't work as two pieces of code will see the same function using different ABIs.
That said I agree entirely - the conflation of array and pointer is the biggest flaw, it's what "necessitated" the null termination error that people are so fond of calling the biggest mistake.
Re: Soursop and Ponies in Kona: A C++ Committee Trip Report
#58Earlier quoted context omitted.
C++ already has vector and now has span. Your proposal doesn't add anything over those.
Adds: 1. convenience 2. attractive appearance 3. ubiquity 4. better error messages (because compiler knows what they are) 5. one construct instead of two (vector and span) 6. overflow behavior selectable with compiler switch For example: #include std::vector v; vs: int[] v; Many D users have remarked that it's the single best feature of D.
The primary goal of "concepts" appears to be to mitigate the awful error messages, but even for that it fails.
For example, let's imagine Hashable from any other language, and look at a C++ concept version:
template
concept Equatable = requires (const T& a, const T& b) {
{ a == b } -> std::same_as;
};
template
concept Hashable = Equatable && requires (const T& a) {
{ a.hashCode() }->std::convertible_to;
};
and an implementation: struct Thing {
size_t hashCode() const;
};
bool operator==(Thing, Thing);
Now how do we make sure Thing is actually going to conform to Hashable? with an assert of course, why would we want anything so gauche as declarative syntax? static_assert(Hashable);
You can see the brilliant syntax explicitly disallows us specifying constraints on a concept, and instead we have to use the && expression. My personal belief here is that the banning of constraints in the template name is simply to force people to use logical composition so the people who thought of it can claim people like it.Re: Soursop and Ponies in Kona: A C++ Committee Trip Report
#59Fully agree with #embed. I don't really need the feature often enough to justify it. But it feels fine to use the preprocessor for it. It's annoying enough for the people who need it to have some build-system work-around, so just some simple straight forward implementation seems better than some over-specified solution for every possible use-case (imagine the horror of some template construct with locales/encoding sp…
Also, I think C++ can still use the same preprocessor as C at this point (it's been a while since I've had to deal with that)? If you're going to diverge the preprocessor you should get more benefit out of doing so than "not having #embed". For that matter, having important features like #embed only available via preprocessor also helps undermine the pointy-haired trolls who (allegedly?) keep trying to deprecate the preprocessor entirely in favor of some proprietary build system.
Re: Soursop and Ponies in Kona: A C++ Committee Trip Report
#60Earlier quoted context omitted.
C++ already has vector and now has span. Your proposal doesn't add anything over those.
Adds: 1. convenience 2. attractive appearance 3. ubiquity 4. better error messages (because compiler knows what they are) 5. one construct instead of two (vector and span) 6. overflow behavior selectable with compiler switch For example: #include std::vector v; vs: int[] v; Many D users have remarked that it's the single best feature of D.
Hardly. A std library update is often easier and faster to ship than a new compiler toolchain. Especially in C/C++ world, although it is moderately uniquely terrible in this regard
> 5. one construct instead of two (vector and span)
Incorrect. Vector is an owned type, while both span and your proposal are borrowed types.
> 6. overflow behavior selectable with compiler switch
That sounds an awful lot like a negative to me, not a feature. It's not generally desirable for code behavior to change depending on how it's compiled, makes debugging kinda hard.
Unless you're just referring to things like sanitizers, in which case yeah span & vector both have those same flags.