The Dark Side of C++ [pdf]
21–30 of 33 posts
Re: The Dark Side of C++ [pdf]
#22The author points out that auto_ptr is useless. shared_ptr is broken too. What do you think this program does? #include #include #include using namespace std; using namespace std::tr1; class Node; typedef shared_ptr NodePtr; class Node { public: int data; NodePtr next; Node(int data, NodePtr next) : data(data), next(next) {} ~Node(); }; Node::~Node() { /* cout
I don't see the problem. The nodes of the list are freed from beginning to end, and then "Done" is printed. What's supposed to be wrong here?
Re: The Dark Side of C++ [pdf]
#23Earlier quoted context omitted.
I don't see the problem. The nodes of the list are freed from beginning to end, and then "Done" is printed. What's supposed to be wrong here?
Stack overflow for large n.
Re: The Dark Side of C++ [pdf]
#24Earlier quoted context omitted.
"encouraged coding styles of modern and real OOP C++" Where do I go to learn those given that I work in an all C shop? One of the problems of learning C++ is the sheer profusion of material that's available, much of it written when the technology looked a lot shinier than it does now. Would you care to recommend some books or articles on C++ style that have stood the test of more than one fashion-epoch? I'm especiall…
I really do recommend the C++ FAQ book. There is a lite version online: http://www.parashift.com/c++-faq-lite/ Since I've read both the lite online version and the book I strongly encourage you to obtain the book version! rgds, René
Re: The Dark Side of C++ [pdf]
#25Most of the problems mentioned there don't apply to the regular C++ coder in his daily life, many of the mentioned problems are even non-existant if you stick to the encouraged coding styles of modern and real OOP C++. In practice just the template error messages suck as hell. I'd really like something nicer there, but in practice you actually survive those messages without too much wasting of time. You just ignore t…
"encouraged coding styles of modern and real OOP C++" Where do I go to learn those given that I work in an all C shop? One of the problems of learning C++ is the sheer profusion of material that's available, much of it written when the technology looked a lot shinier than it does now. Would you care to recommend some books or articles on C++ style that have stood the test of more than one fashion-epoch? I'm especiall…
Remember, object orientation is an attribute of a program, not a programming language. A given language may encourage or even force a certain paradigm, but it's still a property of the resulting program. An "object oriented" language is simply a language in which it is difficult or impossible to produce a program that does not have that property. Object-oriented programming in C is perfectly possible, and often quite desirable. It isn't quite as slick but it's not terribly hard.
(That said, NewSoftzzz's suggestion of the C++ FAQ Lite is still a good one. I think it's just plain required reading, personally. Even if you don't program in C++, it will step you through a lot of scenarios in one very popular OO paradigm and simply by understanding one paradigm perfectly, it is easier to understand and use the next. If this seems contradictory to my first paragraph, blame English. This is theoretically helpful, learning C++ won't practically help you much in C.)
Re: The Dark Side of C++ [pdf]
#26Earlier quoted context omitted.
I really do recommend the C++ FAQ book. There is a lite version online: http://www.parashift.com/c++-faq-lite/ Since I've read both the lite online version and the book I strongly encourage you to obtain the book version! rgds, René
In addition I'd recommend the C++ FQA lite ( http://yosefk.com/c++fqa/ ) which dissects the FAQ and provides additional, a lot of times quite useful, information.
rgds, René
Re: The Dark Side of C++ [pdf]
#27If you begin to realize that you need garbage collection you probably failed while choosing the appropriate language for your project or subproblem.
Same thing here: struct a{typedef int foo;};struct a1:a{};struct a2:a{}; #define X(b,a) struct a##1:b##1,b##2{};struct a##2:b##1,b##2{}; X(a,b)X(b,c)X(c,d)X(d,e)X(e,f)X(f,g)X(g,h)X(h,i)X(i,j)X(j,k)X(k,l) X(l,m)X(m,n) n1::foo main(){}
Wich sane person would consider writing this a good idea?
Re: The Dark Side of C++ [pdf]
#28Earlier quoted context omitted.
"encouraged coding styles of modern and real OOP C++" Where do I go to learn those given that I work in an all C shop? One of the problems of learning C++ is the sheer profusion of material that's available, much of it written when the technology looked a lot shinier than it does now. Would you care to recommend some books or articles on C++ style that have stood the test of more than one fashion-epoch? I'm especiall…
Are you talking about learning OO to apply in C ? Learning modern C++ OO won't help much. A little, but not much. A quick google on "object oriented c" produced a boatload of good-looking sources. Remember, object orientation is an attribute of a program , not a programming language . A given language may encourage or even force a certain paradigm, but it's still a property of the resulting program. An "object orient…
I suspect the same is true of the skills and knowledge held by an experienced C++ hacker.
So I suspect that the C++ FAQ, and the Sutter book are just the ticket.
thanks
c
Re: The Dark Side of C++ [pdf]
#29Most of the problems mentioned there don't apply to the regular C++ coder in his daily life, many of the mentioned problems are even non-existant if you stick to the encouraged coding styles of modern and real OOP C++. In practice just the template error messages suck as hell. I'd really like something nicer there, but in practice you actually survive those messages without too much wasting of time. You just ignore t…
"encouraged coding styles of modern and real OOP C++" Where do I go to learn those given that I work in an all C shop? One of the problems of learning C++ is the sheer profusion of material that's available, much of it written when the technology looked a lot shinier than it does now. Would you care to recommend some books or articles on C++ style that have stood the test of more than one fashion-epoch? I'm especiall…
For example, the code of LLVM, Ogre, Box2D, bullet and the Second Life viewer, even though they're not always perfect, have all taught me useful things and all look far better than any of the large commercial C++ code bases I cut my teeth on.
Re: The Dark Side of C++ [pdf]
#30it's hard to take an article like this seriously - i just want to make 2 highlights. he started using C++ when the STL didn't exist yet. This is ancient IMO, so his section on ever-changing standard is moot to me. if he didn't want to maintain the code base, then he should have kept using an older compiler. second highlight, errors messages - Debugging is the first skill programmers (re)learn, so IMO it's a pretty im…
Really? I dare you to make Python code as hard to read. It has mutability, too.
Hell, does C code have that same amount of overloading? The worst things C offers are function pointers and preprocessor hijinks* , while C++ proudly adds whole new categories of ways to make code hard to parse or reason about. (To say nothing of compile times.)
I learned C++ before the STL, too. For what the STL accomplishes, I'd rather just use OCaml. C + Lua is also nice - the division emphasizes their strong points, and each seems to keep each others' complexities in check.
* http://www.reddit.com/r/programming/comments/b507c/ask_reddi...