The problem with C++ is the constant introduction of unneeded features that are infinity obscure in necessity. People will say "Oh just don't use that feature" but that's not how this works. If something is there it is used. In reference to C, I don't think I know of a single feature or release that had major changes in how I wrote C. Maybe C99 and allowing me to declare in a for loop. I've been using C++ for class t…
Talking to C Programmers about C++ [video]
81–90 of 128 posts
Re: Talking to C Programmers about C++ [video]
#82After 20 minutes spent complaining that nobody listens to him, several minutes of diversion to come to the point that people are not rational because they favour world view and moral sense (characteristics that he calls 'emotional') compared to self-interest, and that he finds that dismaying. Well, I am dismayed that one may consider prioritising selfishness and immediate interest as rational and prioritising global…
Re: Talking to C Programmers about C++ [video]
#83In my opinion, many C++ projects would be simpler, cheaper, safer, and better maintained, if were written in C (with adequate libraries, e.g. for strings, vectors, maps, threads, timers, sockets, etc.).
Re: Talking to C Programmers about C++ [video]
#84After 20 minutes spent complaining that nobody listens to him, several minutes of diversion to come to the point that people are not rational because they favour world view and moral sense (characteristics that he calls 'emotional') compared to self-interest, and that he finds that dismaying. Well, I am dismayed that one may consider prioritising selfishness and immediate interest as rational and prioritising global…
Re: Talking to C Programmers about C++ [video]
#85Re: Talking to C Programmers about C++ [video]
#86Earlier quoted context omitted.
The problem with posts about C++ on Hacker News is that people who aren't experienced C++ programmers (you've been using C++ for a semester? do tell) feel compelled to write posts explaining the problems with C++.
So my opinion on the difficulty of learning features in a language are not valid since I'm just learning the features? Bravo. My problem is not with what I think you are attributing to me but rather other issues with the language and tool chain. There seems to me very little that can be done in C++ that can't be done cleaner in C. It's evident that most people who use a language aren't going to have time to spend yea…
C++ isn't a great choice for many purposes, but for some purposes it is the go-to language - and for good reasons, not just because of inertia as some like to suggest.
As with all forms of craftsmanship, you need to choose the right tool for what you're trying to accomplish.
Re: Talking to C Programmers about C++ [video]
#87Earlier quoted context omitted.
The problem with posts about C++ on Hacker News is that people who aren't experienced C++ programmers (you've been using C++ for a semester? do tell) feel compelled to write posts explaining the problems with C++.
So my opinion on the difficulty of learning features in a language are not valid since I'm just learning the features? Bravo. My problem is not with what I think you are attributing to me but rather other issues with the language and tool chain. There seems to me very little that can be done in C++ that can't be done cleaner in C. It's evident that most people who use a language aren't going to have time to spend yea…
Re: Talking to C Programmers about C++ [video]
#88Earlier quoted context omitted.
Personally I think that looks pretty good. There's no templates, no inheritance. Not sure what would make bloat there nor latency. Whatever the faults of the syntax for folding, it's got to be better than VA_ARGS hasn't it?
There are templates: for example void print1(auto x){std::cout is a function template template void print1(T x){std::cout This is not valid C++14 however, so it doesn't compile. If you replace these, you'll probably still get a stack overflow while expanding the templates because there are almost 7000 arguments to a single function call.
It is "valid C++" IF there are fewer arguments, like 6-10
The example illustrates C++ internal representation of "variadic functions".
Re: Talking to C Programmers about C++ [video]
#89Earlier quoted context omitted.
No, not really. Complexity is not about the language: It's about how you use it. It's not necessarily Java's featureset that makes it so complex, it's its idioms. C++'s lifetime rules, on most variables, are this: It's allocated until you say it isn't. Some of the vars might be refcounted or GCed, but with GC you've still got the same problem on your hands as finalizers, and refcounting can't handle cycles. Manual me…
I'd be interested to hear why you say that RAII cannot be idiomatic. With `std::unique_ptr` and `std::shared_ptr` for handling pointers, `std::vector` for handling data arrays, `std::string` for handling char arrays, I would argue that modern C++ is very heavily RAII. At this point, if I have a class that cannot be declared on the stack, with cleanup handled by RAII, I consider it to be a broken class. Good point on…
The hardware keeps changing. What Lisp provides is a way to access low-level details when necessary, but with a default mode of operation that is managed (developer-friendly): GC, safety checks, arbitrary precision integers, etc. Like for all languages, a compiler can be told to try more optimizations if you want, and if you are ready to spend a little more work on it. In some implementations, you can extend the primitives known the compiler to emit better assembly code (e.g. https://www.pvk.ca/Blog/2014/08/16/how-to-define-new-intrins...).
Re: Talking to C Programmers about C++ [video]
#90The problem with C++ is the constant introduction of unneeded features that are infinity obscure in necessity. People will say "Oh just don't use that feature" but that's not how this works. If something is there it is used. In reference to C, I don't think I know of a single feature or release that had major changes in how I wrote C. Maybe C99 and allowing me to declare in a for loop. I've been using C++ for class t…
When I think about features in C++ that I would love to have in C, the only thing that comes to mind is constructors and deconstructions for RAII.
If I say:
int i;
I don't expect that to create an integer. I expect that to reserve memory in the program's space for an integer.In the same way I don't expect this to call malloc:
int *i;
I just expect that to hold the space in the program data where and int pointer can be stored.Furthermore I don't expect this to run any code (just as the other two).
string s;
I don't expect that to construct anything, that's just a place for me to put data. This way, we know not to use data before it's initialized.In C++:
int i;
if (i > 10) printf("Greater then 10\n");
Is that going to always work how we expect it?How about:
string s;
if (s.length() > 10) printf("Len is greater then 10\n");
That is going to always work how we expect it since it was constructed.This is fundamentally different then uninitialized integers or primitives so I dislike it's use.
I strongly dislike the use of this term but it in my mind is an "Anti-pattern" as it promotes two separate ways of thinking about variables that are fundamentally completely different.
Info taken from:
http://www.cplusplus.com/reference/string/string/string/ http://www.cplusplus.com/forum/general/67249/
Now I'm no expert in education but this knowledge has taken me years to learn through my life and I don't think I'd have been able to do it if I didn't LOVE computers and programming.
I don't know how someone would think that this is good behavior because of it's inconsistencies between two outwardly similar cases.