www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: D Language 2.0

reply Ben Hanson <Ben.Hanson tfbplc.co.uk> writes:
dsimcha Wrote:

 == Quote from "Jérôme_M._Berger" (jeberger free.fr)'s article
 PS: At work, we mustn't use C++ because:
 - It's slow;
 - Its standard library is too big (100k);
 - In a future product, we might want to reuse this module and not
 have C++ (Oh, yes I didn't tell you that we *do* have the C++ stdlib
 in our products because the web browser they bought to run their
 HTML+Javascript+HTML+XML+C+XML+C+XML+C GUI uses it, but *we* aren't
 allowed to, fckng morons)

This is a great point and deserves to be highlighted: D was meant to be a better C++, not a better C. If someone won't use C++ instead of C (apparently there are a decent amount of these people), then there's not a snowball's chance in hell they'd use D, even if we fixed the binary size issue, made D more usable without a GC, and in general made it in every way at least as efficient as C++.

That's all very well - you don't have to look further than Linus Torvalds for the attitude that C is the be all and end all and anything else is just cheating... *But* there are plenty of C++ programmers who really do care about every little bit of performance. Indeed, C++ programmers who are paranoid about performance and perhaps write C++ a little too in the C style are often criticised and told to modernise 'the compiler will take care of it' etc. When I wrote lexertl (http://www.benhanson.net/lexertl.html) it was using VC++ 6 and I ended up with the following case: void remove_duplicates () { const CharT *start_ = _charset.c_str (); const CharT *end_ = start_ + _charset.size (); // Optimisation for very large charsets: // sorting via pointers is much quicker than // via iterators... std::sort (const_cast<CharT *> (start_), const_cast<CharT *> (end_)); _charset.erase (std::unique (_charset.begin (), _charset.end ()), _charset.end ()); } Later I was told 'oh, VC++ 6 is dead, no need for such crufty hacks, modern compilers take care of it'. But what's this? Microsoft now consider STL to be unsafe and have added loads of range checking, slowing down C++ massively. Now it's true that most of that checking occurs in Debug, but even in Release some of it is there. This kind of thing really burns those coders who are trying to save every cycle. Again, for the really hard core C coders point of view see this: http://blogs.msdn.com/oldnewthing/archive/2005/06/13/428534.aspx Scroll to the last comment. The point is coder mentality is a sliding scale. Don't give the C bigots any more ammunition than they already have... Please! Regards, Ben
Jan 20 2010
parent Ben Hanson <Ben.Hanson tfbplc.co.uk> writes:
By the way I forgot a link to 'Secure STL':

'nuff said.


Jan 20 2010