But as people have pointed out, D doesn't do a lot of what people like me need it to do. For me, there's no real replacement for C++. Sure, D, Rust, and a number of other languages are fine for user-level applications, but for developers that program device drivers, RTOS's, and Embedded Systems, its C++ or bust. Yes, the language at this point is a PITA, but at the end of the day, you have the flexibility, capability, and performance that no other singular language allows.
Announcement
Collapse
No announcement yet.
The State Of C++1z In LLVM / Clang
Collapse
X
-
Originally posted by swoorup View Post
TBH, C++ is overly complicated language, and the fact that they keep adding more features to it (burrowing it from other languages like modules) makes it even more complicated and cryptic.
Myself? I just bumble along using just the parts of C++ that I can actually understand. I tend to use C++0x era code (i.e std::weak_ptr which I find beats garbage collection hands down (especially when integrating with lower level C APIs. Sometimes there really is no way to handle the lifetime of an object and std::weak_ptr allows for this)).
As for all this new fangled future<T>, auto etc... Meh, leave all that to the cool kids
Comment
-
Originally posted by gamerk2 View PostRTOS's, and Embedded Systems, its C++ or bust. Yes, the language at this point is a PITA, but at the end of the day, you have the flexibility, capability, and performance that no other singular language allows.
I recently started work on an embedded project requiring only C and... argh dangling pointers. There was no easy way to know if some random function was going to free the memory pointed to or not. It would be nice if there was a clean segfault at the immediate source of a problem but stuff tends to just keep on going until the memory is trashed. Basically the problem...
Code:struct SomeStruct *ptr = SomeStructCreate(); DoSomething(ptr); // is ptr still valid? How do we know if DoSomething has freed the data or not?
Code:REF(SomeStruct) ptr = SomeStructCreate(); DoSomething(ptr); // GET(ptr) is guaranteed to return NULL if DoSomething has freed the data
Anyway... back on topic to C++ lol.Last edited by kpedersen; 06 April 2016, 08:18 AM.
Comment
-
Originally posted by gufide View Post
Well, there is still no variadic templates and no specialization. Once this is backed into the language, I would happily say that Rust the best candidate as a safe C++ replacement. At the moment I'll continue to say that C++ as no real safe replacement.Last edited by caligula; 07 April 2016, 07:46 AM.
Comment
-
Originally posted by kpedersen View PostI honestly cannot see how kernel developers write such stable C code without any crutches like this!
Here is a concrete example from the kernel code: when writing a netfilter hook you get a pointer to an skb that represents the incoming packet. You can do whatever you want with it, free it or not, but if you do free it you MUST return NF_STOLEN. The opposite is also true, if you return NF_STOLEN you MUST free it yourself or memory will be leaked.
Comment
-
Originally posted by pal666 View Postthat is common misconception
c++ core language spec is of the same size as java or c#.
library spec is order of magnitude smaller
http://www.open-std.org/jtc1/sc22/wg...2014/n4296.pdf
Comment
-
Originally posted by swoorup View PostYeah, just C++ 14 specification is very small of just only 1368 pages. And this is just C++14, lol
http://www.open-std.org/jtc1/sc22/wg...2014/n4296.pdf
now enumerate pages of java standard library and c# standard library
btw, 'lightweight' and 'simple' c11 is 700 pages and most of the diff is in library http://www.open-std.org/jtc1/sc22/wg...docs/n1570.pdfLast edited by pal666; 07 April 2016, 04:44 PM.
Comment
-
Originally posted by caligula View PostAgain that doesn't explain in any way why those features are needed in a language.
you could find detailed explanation in motivation section of http://www.open-std.org/jtc1/sc22/wg...2004/n1704.pdf
next time you need an explanation, just look it up in relevant proposal instead of posting bullshit
Originally posted by caligula View PostVariadic templates are really problematic wrt typing unless you have something that's a lot better than what C++ offers.Last edited by pal666; 07 April 2016, 08:37 PM.
Comment
Comment