- Rust has the same memory problem as C and C++ - 4 Updates
James Kuyper <jameskuyper@alumni.caltech.edu>: Apr 19 04:53PM -0400 On 4/19/20 2:29 PM, Paavo Helde wrote: >> three times: > Regarding memory allocation the common subset of C and C++ is almost > empty. In C, memory can be allocated three ways, statically, automatically, and dynamically. C provides four functions for dynamic memory allocation malloc(), free(), realloc(), calloc(). Every memory allocation feature of C is also a feature of C++, so the common subset is the same as the entirety of C's memory allocation features. While that set is small, I can't see any justification for calling that set almost empty. If it is almost empty, then C's features for memory allocation are almost empty. Would you be willing to accept that assertion? ... >> C that makes it vulnerable to buffer overflows. > Yes, C++ supports unsafe code, this is a major selling point because of > C back-compatibility. I was addressing only the reasonableness of using "C/C++" when writing a document comparing those languages with Rust. I know nothing about Rust, and have no interest in it, and in particular, no interest in discussing how it compares with C/C++. >> either language provide that kind of promise? If so, what precisely is >> the wording of the promise. > I do not argue that C or C++ cannot be used in unsafe ways. That's not what he's saying - he's saying that C and C++ can both be used in the same unsafe ways. That's certainly true, since you can write well-formed C++ code that looks and behaves essentially the same as the unsafe C code. ... > Yes, C++ supports writing unsafe C code. And that fact is sufficient to justify referring to defects of C/C++, because both languages share those defects though their shared common heritage. |
Melzzzzz <Melzzzzz@zzzzz.com>: Apr 19 08:56PM > And that fact is sufficient to justify referring to defects of C/C++, > because both languages share those defects though their shared common > heritage. There is no choice. If language requires portion of code to be written in assembler that's not business. That is why ADA never took of ;) -- press any key to continue or any other to quit... U ničemu ja ne uživam kao u svom statusu INVALIDA -- Zli Zec Svi smo svedoci - oko 3 godine intenzivne propagande je dovoljno da jedan narod poludi -- Zli Zec Na divljem zapadu i nije bilo tako puno nasilja, upravo zato jer su svi bili naoruzani. -- Mladen Gogala |
richard@cogsci.ed.ac.uk (Richard Tobin): Apr 19 09:29PM In article <chine.bleu-C2A2E3.08300419042020@reader.eternal-september.org>, >> https://simpleprogrammer.com/what-does-cc-mean/ >It's how spanish sailors answer orders. The motto of the French navy: a l'eau, c'est l'heure. -- Richard |
jacobnavia <jacob@jacob.remcomp.fr>: Apr 20 01:23AM +0200 Le 19/04/2020 à 21:37, Jorgen Grahn a écrit : > Maybe the main benefit of C++ in this area is that you're not tempted > to use fixed-size buffers for things with no fixed max size. > /Jorgen If you use the C containers library you do not have to either. I wrote that library and presented it to the C committee. They told me that C++ does that already. So, C was denied that path. |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment