I downloaded that book thinking knowing some C++ couldn't hurt. It might even make me a better programmer. Etc.
Then I see code like
template<class T> class Ptr { public:
// new member to copy the object conditionally when needed
void make_unique() {
if (*refptr != 1) {
--*refptr;
refptr = new size_t(1);
p = p ? p->clone() : 0;
}
}
// the rest of the class looks like Ref_handle except for its name
Ptr(): refptr(new size_t(l)), p(0) { }
Ptr(T* t): refptr(new size_t(l)), p(t) { }
Ptr(const Ptr& h): refptr(h.refptr), p(h.p) { ++*refptr; }
Ptr& operator=(const Ptr&) ; // implemented analogously to §14.2/261
~Ptr(); // implemented analogously to §14.2/262
operator bool() const { return p; }
T& operator*() const;, // implemented analogously to §14.2/261
T* operator->() const; // implemented analogously to §14.2/261
private:
T* p;
size_t* refptr;
};
MY FUCKING EYES FUCKING HURT BECAUSE THIS FUCKING CODE IS FUCKING TERRIBLE.
THIS CODE IS SO TERRIBLE THAT COULD ACTUALLY WIN AT THE UNDERHANDED C CONTEST.
(http://www.brainhz.com/underhanded/)
p=(p=p?p=p:0);
LOOK HOW COOL MY CODE LOOKS LIK
Name:
Anonymous2007-04-06 7:38 ID:ryKTpqqR
I really don't see what's so bad about the block of code in >>7. The only thing I find stylistically unappealing is putting the public: right after the opening brace.
All the actual code is straightforward and pretty simplistic. Good example code.
It's a very straightforward reference counted pointer. It's not like the average dev ever really needs to write this sort of thing, that's what Boost is for, but this block is neither complicated nor particularly difficult to understand. Hell, there are only 5 lines of actual code! The rest is just boring, humdrum plumbing
Name:
Anonymous2007-04-06 10:23 ID:ryKTpqqR
If you're going to be a pussy about programming in C++, at least be a pussy about stuff that's interesting.
Oh lawd. Stay far away from this book if you're a newb. It'll only scare you, and you'll never come back. It's a good book for reference, or improving skills if you already know the basics, but learning from that is a bad bad idea. There are many other texts out there that are just as good, as far as content goes, but more newbie friendly.
Name:
ALAN COCKS2007-04-08 19:37 ID:Txr6KK6V
HELLO I AM ALAN COCKS, FOUNDER AND CEO OF LINUX KERNEL BRANCHES AND BUGFIXES. I ADVISE YOU TO STICK TO C AND JOIN OUR CLUB OF HIPPY LINUX CODERS. YOU'RE GOING TO LIKE THE WAY YOU LOOK (CHECK WIKIPEDIA FOR MY PICTURE). I GUARANTEE IT.
>>44
Does that include SICP? So that you would, in pseudocode:
read (books) = nothing if no books, else read (car books); read (cdr books)
Name:
Anonymous2007-04-10 7:32 ID:lmOV7w2n
stroustrup is a douche
Fucking win
Name:
Anonymous2007-04-10 14:39 ID:9Sc8Hi8S
douche
|doō sh |
noun
a shower of water : a daily douche. • a jet of liquid applied to part of the body for cleansing or medicinal purposes. • a device for washing out the vagina as a contraceptive measure.
PROTIP: THE EXPRESSION YOU'RE LOOKING FOR IS "DOUCHE BAG":
noun
a small syringe for douching the vagina, esp. as a contraceptive measure. • informal a loathsome or contemptible person (used as a term of abuse).
Name:
Anonymous2007-04-10 17:32 ID:+wNob60W
PROTIP: THE EXPRESSION IS PORK
Name:
Anonymous2007-04-11 6:24 ID:otdYT8MS
Since when was a douche a contraceptive? You're supposed to clean your vagina so it doesn't start to stink. Thread over.
[a]a[/a] b
[c]c[/c]
[d]d[/d]
[e]e[/e]
[f]f[/f]
[g]g[/g]
[h]h[/h] i
[j]j[/j]
[k]k[/k]
[l]l[/l] m
[n]n[/n] o
[p]p[/p]
[q]q[/q]
[r]r[/r] s
[t]t[/t] u
[v]v[/v]
[w]w[/w]
[x]x[/x]
[y]y[/y]
[z]z[/z]
Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy