Log in

View Full Version : Kinda off topic. I need a good book on C++


Latigo
April 5th, 2001, 09:01
Howdy!
Can you recommend me a good book on C++?
I need to learn and never did anything on C++
Thanks!


Latigo

tsehp
April 5th, 2001, 18:13
what a great decision ! mail me, I can send you teach yourself c++
in 21 days, great one to start.

Clandestiny
April 5th, 2001, 20:06
Hi Latigo,

Thinking In C++ by Bruce Eckel is pretty good too. Email me and I can send you a copy of it.

Cheers
Clandestiny

Solomon
April 6th, 2001, 06:15
I have the following books on C++:
C++ by example(for beginners, PDF, 3.6MB)
Effective C++, More Effective C++(not for beginners, HTML, 8MB)
ANSI-ISO-C++.Professional.Programmer.Handbook(PDF reference book, 700KB)

contact me if u r interested. u can also get some from onlinereferences.cjb.net.
solomon2000@gmx.net

Latigo
April 6th, 2001, 10:41
Hi guys and thanks very much for your generosity.
I'll contact each and every one of you right now
Thanks again.

Latigo

tsehp
April 6th, 2001, 15:53
btw, just asking, is someone interested and ready to contribute
on a new created forum here on c++ applied to rce ?

I just don't know if there are enough c++ coders here, but this maybe could be interesting ?

ThrillSeeker
April 6th, 2001, 15:53
+Tsehp and Clandestiny, may i have a copy also?

Clandestiny
April 6th, 2001, 17:29
Quote:
+Tsehp (04-06-2001 13:53):
btw, just asking, is someone interested and ready to contribute
on a new created forum here on c++ applied to rce ?

I just don't know if there are enough c++ coders here, but this maybe could be interesting ?



Hi +Tsehp,

I think an RCE targeted C++ forum is a very interesting and good idea :-) I'd love to participate in (and have the support) of other reversers on C++ coding issues related to reversing.

Cheers,
Clandestiny

Clandestiny
April 6th, 2001, 17:34
Quote:
ThrillSeeker (04-06-2001 13:53):
+Tsehp and Clandestiny, may i have a copy also?


Hi ThrillSeeker,

Sure, I'll send ya a copy...but I'll need your email. Mail me direct, if you don't want to post it on the forum. The file is approx 1.7 megs, btw.

Regards,
Clandestiny

Latigo
April 6th, 2001, 18:55
Quote:
+Tsehp (04-06-2001 13:53):
btw, just asking, is someone interested and ready to contribute
on a new created forum here on c++ applied to rce ?

I just don't know if there are enough c++ coders here, but this maybe could be interesting ?

Latigo
April 6th, 2001, 18:56
Quote:
+Tsehp (04-06-2001 13:53):
btw, just asking, is someone interested and ready to contribute
on a new created forum here on c++ applied to rce ?

I just don't know if there are enough c++ coders here, but this maybe could be interesting ?


Well, i'm just beginning but i'm interested in it anyway

tsehp
April 6th, 2001, 19:26
Quote:
ThrillSeeker (04-06-2001 13:53):
+Tsehp and Clandestiny, may i have a copy also?

same for me, mail me directly.

tsehp
April 6th, 2001, 19:29
Quote:
Clandestiny (04-06-2001 15:29):
Quote:
+Tsehp (04-06-2001 13:53):
btw, just asking, is someone interested and ready to contribute
on a new created forum here on c++ applied to rce ?

I just don't know if there are enough c++ coders here, but this maybe could be interesting ?


I'm dreaming of this since a while now, let this topic develop a little and see if we have enough c++ programmers here to animate this forum, maybe arthaxerxes and mostek if they are not too busy could be interested.



Hi +Tsehp,

I think an RCE targeted C++ forum is a very interesting and good idea :-) I'd love to participate in (and have the support) of other reversers on C++ coding issues related to reversing.

Cheers,
Clandestiny

MO_K
April 6th, 2001, 20:12
RCEing C++,

am I the only one missing the point here?

Which part of reversing a C++ writen app
needs an special attention?

C++ only adds a layer of abstraction to C,
to accomodate the design and implementation
in an O-O way. After the compilation, this
layer boils down to -sigh- "bloat"; the stuff
that makes printing disasm-listings impossible.

If you want to investigate how a given C++
compiler translates the high level OOP
concepts and constructs to assembler, that
is fine, and will help you recognize patterns
in listings. But isn't that the same thing
flirt does? why waste time?

The next thing that comes to mind is manual
demangling, which is also a waste of time;
since each and every compiler in the market
has been *studied*, and well documented.

Here i go again, J0y~Ki11

tsehp
April 7th, 2001, 01:48
[QUOTE]MO_K (04-06-2001 18:12):
RCEing C++,

am I the only one missing the point here?

Which part of reversing a C++ writen app
needs an special attention?

quote]
not reversing, but building some reversing tools, just like revirgin for example that is entirely build with c++.

mo k
April 7th, 2001, 03:18
ooooh, ok, i get it now

Yeah that will be good. Just make sure you don't
let the volatile aspects of the application creep
into the main objects.

If you are into engineering, you can put the
user interface, and the standard code in the
base classes, and make it available to the extended
version of the application through inheritance.

Say for example a universal unpacker; you can
put the gui and DOS unpackers in the base classes, since they are unlikely to change.
And make the newest unpacker inherit this base
code -- voila, instant app. Then after stabalizing
all the versions of a given packer, put it into the
base, and initialize it each time with a constructor.

I don't know, may be after you implement such tool,
you will come to the conclusion that, yes, it is
better to write a C library of unpacking functions
and call them in an instant

Home Team 1 : Joy~kill 2

mo k
April 7th, 2001, 03:58
Speaking of the books,

If you want a good introduction to a given
technology, always read the most frequently
recommended book, even if you have to pay for it,
or if they are rock hard.
Make sure the recommendation doesn't come
from the publisher, or dumb amazonians. But a
respected publication, or perhaps the FAQ of the
USENET group dedicated to that technology.

I learnt C++ from Waite Group's Turbo C++
by Robert Lafore; it was a primitive book and
tought me a little about the language.
I then moved to the Borland C++ manual, which
was a misnomer, and tought nothing more than
how to use the BC3 IDE.
Down the road, i learnt the language from
different angels, without really learning the
language itself.

So, if you are buying a CS book, make sure it is tought in the univerisites. and that it has good
and sound excerises, if you have a programming
background, see if the examples are practical,
best books are those that stress the application
of a given technique in the real world, and also
provide an explanation of the theory behind it.
Books that stress the mathematical foundation
of a given techology are almost always perfect.
If a book tells you to implement a deque in
the language at hand, using a data structure
implemented in the previous chapter, know you
are in good hands.

All those commercial books come with little or no
excercises, because they are not meant to teach.

Avoid authors that try to impress you; Herebrt
Schildt is such one.

Buy only Adison Wesley and Prentice Hall books, the
rest are only to rip off the poor IT newcomers.

Learn the concepts behind the given language.
In C++ learn the guts of OOP, and perhaps its
alternatives. Read language independent books
that introduce the topic, in OOP, Booch is such
one. It is usaully better if the author discusess
the pros and cons of the given technology.
Die hard Fanatics of their own creation, Like
Bertrand Meyer are only good for the experienced
ones, they will take the newbie to a one way ride
to unsertainty.

Never buy platform dependent books, as an
introduction. They will concentrate on the OS,
the CPU, the Compiler, the IDE, but not the
topic at hand.

Look in the references or the Bibliography section,
if all the titles there, are by the same author or
publisher, bail out, it is a bait. O'Reilly books are
an exception, they are in a class on thier own,
but their C/C++/algos/data structures books suck.

mo k
April 7th, 2001, 04:00
/*
* Continued from above, due to message size
* restrictions
*
/


Look at the examples in the book; some books
are writen by specialized programmers, if you see
the theme of a given type of an application
running throughout the chapters, bailout.
example, if the author comes from a financial
background, all the examples will have a banking
accent to them, which will narrow your understanding
of the application of the given technology.
Perl books are full of CGI examples.


Avoid books that devote major chapters to
"new" techniques; extreme programming is one such,
XML is another.
Unless the techology at hand relates to the other;
i.e. it is OK for an apache book to explain mod_perl.

See if the author has writen any other
books realting to the topic. See if the
book is a rehash from a previous book.
for example, if you want a data strucures
and algorithms book in C++, Robert Sedgewick
is your man, but wait, if you can get his C book
for half the price, you do just well, because it
is the same thing.
For another example Deitel&Deitel, these guys
have fooled many pros into their trust; their
books are sucky rehashes, avoid by all means.

Don't buy books that try too be everything --
there exceptions i know.
Get an introductory book, and applications book,
and a reference.
Most of the time, an electronic reference in better
than a hard copy one, for its instant reference
and search facilities. All the API references in the
world are somewhere online, so don't pay a penny
fore'm. On the other hand, a hard copy intro is
the best. If you are like me, and go through a
period of labor and meditation when learing
something new, then you know a good intro
book is the best thing to walk around with, and
take to the bathroom

Finally, make sure the book is writen by a practicing
educator, if you are a beginner in the topic.
Professionals don't teach the alphabet, they
assume you are bathed and diabered, and they
will go right to the subject matter.

Latigo
April 7th, 2001, 11:03
Thanks very much for such detailed explanation Mo_K!!!!!!

Latigo

tsehp
April 7th, 2001, 18:50
Teach yourself c++ in 21 days was extremely interesting to me
for the first approach, almost every aspect of c and c++ is covered,
gradually and you don't get lost inside, every chapter is ended with a bunch of exercises so you just have to self estimate yourself at each chapter.

But ask mo k said OOP is a very important concept to understand, and in this book the concept is not very well covered with explanations, you'll just build some classes manually just without understanding how you should really build them to be well OOP compliant and more important how to make them really reusable.

Next you'll have to choose your c++ IDE, I'll advice you to choose borland c++ builder 5 and buy the related book teach yourself c++ builder 3 in 21 days, I will not even talk about ms visual studio and the mfc classes that are really belonging now to the past.

m0sk
April 7th, 2001, 22:24
Hi,

I'm more like a c-coder myself, and never got far in learning c++. I can advise you *not* to buy `c++ primer by Lippman & Lajoie', as I found it to be not suited for a beginner (although the book was recommended lecture for my introductionary class in c/c++). My fellow students also found the book pretty useless. You'd better get `thinking in c++ by Bruce Eckel'; it seems to be pretty good from what I hear. Best of all, you can get it free at the authors' homepage (h**p://www.bruceeckel.com).

And now a question: what about `The C++ Programming Language by Bjarne Stroustrup'? *The* standard I guess...Can anybody recommend it? Would it be useful for c++ newbies with a firm background in c? (I realise though that c and c++ are really 2 completely different languages/concepts...)

Regards,
m0sk

BTW: Tsehp, can you elaborate a bit more on `ms visual studio and the mfc classes that are really belonging now to the past' --just curious ;-)

Maldoror
April 9th, 2001, 03:43
+Tsehp:
"btw, just asking, is someone interested and ready to contribute
on a new created forum here on c++ applied to rce ?

I just don't know if there are enough c++ coders here, but this maybe could be interesting ?"

Not very bad idea!
I vote Yes.

Maldoror

miscreant
April 17th, 2001, 12:26
Prentice Hall are very good, as are sams teach yourself series. Also try to find a chapter listing before you buy a book, otherwise you end up with 80% of the book on databases, and only 20% covering the language on the cover of the book.

mammon_
April 18th, 2001, 14:37
have to agree with mo_k on a number of issues here.

Good Publishers:
A/W, Prentice Hall, MorganKauffman [sometimes].
'Iffy' Publishers:
R&D, O'Reilly
'No fargen way' publishers:
Sams, Wrox, Que, IDG, New Riders

The 'no fargen way' books seem the cheaper, easier route, but in the long run it is not worth it. You end up, at some point, having to relearn programming.

If a book turns out to be 'too hard', you have either chosen a book by a bad author [hint: hit the author's site before making a purchase, also do a google search on the title and see how many people say the book is awesome on their own pages], or you have more to learn than you realize. Do not shortcut by getting a 21-days book ... bite the bullet and do the learning. Of course if you don't want to be a good programmer then you can ignore this and buy whatever the hell book you like

Another thing: Don't learn C++ ;P
Well, OK, learn it, just never use it. Writing your apps in C++ is the very first step on the road to becoming a Java whore. But then again, since most of you guys are on windows, I guess you can't get away from it...

Book Suggestions:
I liked Deitel & Deitel's 'C++: How To Program'. It is a good newbie book while at the same time teaching sound programming and supplying decent reference material.

However, as a 'road to c++', I recommend the following steps:

+Learn C Thoroughly+
Get the Kernighan book
Get the van der Linden book

+Use C for OOP-style stuff+
Get 'C Interfaces and Implementations'
Get a data structures/algorithms book by Standish or Sedgewick.

+Get a decent C++ book+
You're on your own here. Check the AW 'professional reference' [white cover w/ splash of color and blue back] series.

+Get a C++ Algo Book+
Probably Sedgewick is the best here.

+Get Some OOP Design Books+
Just to make sure you 'get it'.



Doing rce apps in C++:
um, why?
well, anyways, check out the Borg source code, you'll see some neat things. As always, the best instruction comes from looking at other peoples' source ... borg will give you some OOP-based disassembler code to play with.


_m

Fatboy Joe
April 19th, 2001, 06:40
>C++ only adds a layer of abstraction to C,
>to accomodate the design and implementation
>in an O-O way. After the compilation, this
>layer boils down to -sigh- "bloat"; the stuff
>that makes printing disasm-listings impossible.

Where does this bloat come from? What exactly gets bloated?
I am curious about this.

strayed
April 19th, 2001, 09:05
Quote:
mammon_ (04-18-2001 12:37):
...

However, as a 'road to c++', I recommend the following steps:

+Learn C Thoroughly+
...
+Use C for OOP-style stuff+
...
+Get a decent C++ book+
...
+Get a C++ Algo Book+
...
+Get Some OOP Design Books+
...
_m


Hi there,
With all due respect to mammon_, do not follow the path he suggested. Learning C in order to approach to C++ is a wrong way. (However, I think that all of you are mastering C so this is not an issue ). Take a look at AW ‘C++ in depth’ series - especially at Accelerated C++ by Andrew Koenig and Essential C++ by Stanley B. Lippman. All other books from this series are bleeding edge books (they are a ‘must’ read if you wonna be a hardcore C++ programmer). For general OOP concepts I would recommend Object-Oriented Software Construction 2nd ed. by Bertrand Meyer. However, I agree with mo_k that he is a little bit ‘Die hard Fanatic of its own creation’ – but for good reason! He teaches *pure* OO methodology.

Quote:
mammon_ (04-18-2001 12:37):
...
Another thing: Don't learn C++ ;P
Well, OK, learn it, just never use it. Writing your apps in C++ is the very first step on the road to becoming a Java whore. But then again, since most of you guys are on windows, I guess you can't get away from it...
...
_m


C++ and Java were not born under Windows :P so it’s not clear what you mean. And beginning programming with C++ doesn’t necessarily mean that you’ll become ‘Java whore’ (only those poor, weak souls will ).

regards,
strayed

mammon_
April 19th, 2001, 15:13
clarification:

of course C++ and Java weren't born on windows. However, virtually all of the profes^H^H^H^H^H^Hcommercial IDEs for windows [and nearly all of the sample code, books, etc] are OOP-biased -- i.e. everyone seems to assume you are using C++ . The recognized alternatives are VB and Java, neither of which win any points for computational efficiency or procedural programming style.

Contrast this with Mac, where things like Smalltack and Obj-C and pascal run things as often as not, and unix, where C runs things. Windows OSes are geared towards C++ -- therefore if you are using windows, you probably cannot get away from C++. But you don't have to like it



"learn c before c++"
I'll stand by this for a number of reasons.

C++ started as a preprocessor for C, and hasn't evolved much. Learn the underlying language.

C++ methods are the same as C functions; in fact, aside from the class notation and supporting language features [new() n' all that], you will be writing C code. Get good at it, or your code will suck.

C forces you to know what your code is doing at a more-or-less system level, particularly regarding memory management. You will learn the computational costs involved with creating new classes etc since you will be doing it all manually -- as a result you will [most likely] refrain from doing things like creating a class for each byte of data when you move to C++. Perhaps I have too dim a view of C++ coders ... but I've never known a good C coder who was a horrible C++ coder.It doesn't work like that the other way around.

Learning to implement algos and ADTs in C will teach you much about modular programming which you can easily miss in C++ lessons. A class hierarchy is its own API [stress the 'interface' part there]; there is no real need to design good interfaces and modular code since the language does that for you. If you think you will never need to know programming design concepts, then please, forge ahead in your ignorance. More coders like you mean higher-paying jobs for coders like me


On second thought, scratch everything I just wrote. I think grugq might be right...

_m

mo k
April 19th, 2001, 17:06
Oh father grugq, forgive us for we have sined,
lamerdom shall haunt us for life, or till slack
goes $rupt and ftp only ;P

I think that shell debugger is not too slow
after all, some of'em here need LiquidPlumber(tm)
to drain things down their heads.

P.S. wanna do a bloat comparison between
bjarne's and ritchie's?
write a main with a single return only and
disassemble it, now *that* is fscking bloat!

For the STILL curious, get Bruce Eckel's for C++
and Pohl and Kelley for C, nuff said.

Fatboy Joe
April 19th, 2001, 21:24
Check the size of a program consisting of a return? This isn't an objective proof of bloatedness. Just because C++ has a slightly larger initialisation and shutdown sequence doesn't make it more bloated. So what if it comes out bigger when just a return is in the program? The same C program compiled is also way bigger than it could be, it copes with the fact that there is no code no better than the C++ compiler. Where does the C++ code really get bloated? A few extra bytes on initialisation and shutdown isn't "a layer of abstraction ... After the compilation ... boils down to "bloat" "

grugq
April 20th, 2001, 03:46
grugq@chao :587 src}--$> cat main.c
#include <stdio.h>

int main (void)
{
printf("Hello World
";
return 0;
}
grugq@chao :588 src}--$> gcc -o c main.c
grugq@chao :589 src}--$> cat main.cpp
#include <iostream.h>

int main (void)
{
cout << "Hello World
";
return 0;
}
grugq@chao :590 src}--$> g++ -o cpp main.cpp
grugq@chao :591 src}--$> ls -l c*
-rwxr-xr-x 1 grugq other 6700 Apr 20 03:13 c*
-rwxr-xr-x 1 grugq other 7032 Apr 20 03:13 cpp*
grugq@chao :592 src}--$> ldd c
libc.so.1 => /usr/lib/libc.so.1
libdl.so.1 => /usr/lib/libdl.so.1
/usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1
grugq@chao :593 src}--$> ldd cpp
libstdc++.so.2.10.0 => (file not found)
libm.so.1 => /usr/lib/libm.so.1
libc.so.1 => /usr/lib/libc.so.1
libdl.so.1 => /usr/lib/libdl.so.1
/usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1
grugq@chao :594 src}--$>


Unfortunately this is a difficult argument to have because the term "bloat" is so vague. Does bloat mean extra instructions that needn't be there, i.e.

call function
movl êx, êx
test êx, êx

Or does it mean additional overhead during processing? i.e.

foo = fopen("file", "r";
while(1) {
ch = getc(foo);
putc(ch);
...

vs.

foo = open("file", O_RDONLY);
while((n=read(fd, buf, sizeof(buf))>0) write(1, buf, n);

??? These aren't very easy to answer and will depend one who you talk to. There are advantages and disadvantages to both. The FILE interface is portable to whatever platform implements a compliant C library, while the file access primitives interface is portable to POSIX compliant systems. This isn't a problem if you code has to only run on a POSIX compliant system, but it does raise the only issue that is important in the bloat discussion: what do you want from your program.

I personally want my programs to get me chics in bars, thats why I use C and the POSIX interface! ;-)

For the sake of arguement I will posit that bloat is any resource (disk space, CPU time, etc) extranious to the intent of the program. This means that any instructions, libraries, .data, etc. etc. which don't *need* to be there are bloat. In this instance I would say that using C++ to print hello world is bloated, I would also say that there are times (though I have yet to encounter any) when C++ is the right tool for the job. On a finaly note:

grugq@chao :608 src}--$> cat main.sh
#!/bin/ksh
echo "Hello World"
grugq@chao :609 src}--$> ./main.sh
Hello World
grugq@chao :610 src}--$> ll main.sh
-rwxr-xr-x 1 grugq other 30 Apr 20 03:25 main.sh*
grugq@chao :611 src}--$>


--grugq.

Epic
April 20th, 2001, 10:05
at http://www.research.att.com/~bs/homepage.html

Kind regards.

strayed
April 20th, 2001, 10:50
Quote:
mammon_ (04-19-2001 13:13):
… However, virtually all of the profes^H^H^H^H^H^Hcommercial IDEs for windows [and nearly all of the sample code, books, etc] are OOP-biased -- i.e. everyone seems to assume you are using C++ .

Give an example of modern IDE for UNIX that is not OO.

Quote:
mammon_ (04-19-2001 13:13):
… The recognized alternatives are VB and Java…

VB – true, Java – false. You can more often encounter Java in UNIX world.

Quote:
mammon_ (04-19-2001 13:13):
…C++ started as a preprocessor for C, and hasn't evolved much…

‘hasn’t evolved much’ - ???!!! No comments…

Quote:
mammon_ (04-19-2001 13:13):
… C++ methods are the same as C functions; in fact, aside from the class notation and supporting language features [new() n' all that], you will be writing C code. Get good at it, or your code will suck.

Nothing can be further from the truth. IMHO, you missed the whole point. Oh, yeah, I see what you mean: as soon as one gets to the point of implementing a member function (this is the correct name; ‘method’ comes from Java world) this will be a good old C – right? But this is a final point of your journey in C++. There is a hell lot of stuff to do before that

Quote:
mammon_ (04-19-2001 13:13):
… Perhaps I have too dim a view of C++ coders ... but I've never known a good C coder who was a horrible C++ coder.It doesn't work like that the other way around.

You know what? I have a completely different experience . C and C++ are *different* languages. That’s true that you can do C coding with C++ (C++ is a multi-paradigm language be it for good or not). Here is a rather common situation: C expert is told that his next project should be in C++ (for whatever reason) – ‘Heh, in C++? No probs! After all, this is just a C preprocessor.’. And then bad things happen…
BTW, the good example can be found at h**p://www.embedded.com/1999/9908/9908feat1.htm. If some of you guys consider yourself at least intermediate C++ programmer try to identify what’s wrong with that C++ code (try to find at least two flaws – one technical and one conceptual) – and do your best to forget about the suitability of C++ for this particular problem ;p .
Bottom line, in order to be a good C++ programmer one should change his flow of thoughts (if he comes from C world). And this change is rather dramatic… That is why I said that the path C -> C++ is a wrong one. Before breaking something down to look what’s inside it try to learn how to use it in the first place.


(to be continued)

strayed
April 20th, 2001, 10:51
Quote:
mammon_ (04-19-2001 13:13):
… Learning to implement algos and ADTs in C will teach you much about modular programming which you can easily miss in C++ lessons.

That’s funny but C++ (as a member of OO community) is specifically designed to express ADT concepts. And it does this much better than C. In fact, this is one of the main reasons of existence of C++ ;-) . Be patient and try to *learn* C++. Then maybe you’ll understand that ADT and modular approach are packed into the concept of … yeah, class. Once you discover that amazing fact you won’t treat class as just a ‘notation’.

Quote:
mammon_ (04-19-2001 13:13):
… A class hierarchy is its own API [stress the 'interface' part there]; there is no real need to design good interfaces and modular code since the language does that for you.

I’m sorry, but my poor C++ mind didn’t get it.

Quote:
mammon_ (04-19-2001 13:13):
… If you think you will never need to know programming design concepts, then please, forge ahead in your ignorance. More coders like you mean higher-paying jobs for coders like me

I want to believe that this is not a personal assault ;p .


That having been said I’m not discussing the C++ suitability for RE purposes. Neither I want to fire a flame war. The initial question was about good C++ books. Let me stress this - the right tool for the right job.

To MO_K:

Try these two test cases:
1. Write a main with a single return only.
2. Do nothing (literally).

I believe you will be by simplicity and elegance of the second approach ;p .


regards,
strayed

P.S. Ah, just in case – I’m not Windows advocate.

mammon_
April 20th, 2001, 12:43
I disagree.

See above.

_m

mammon_
April 20th, 2001, 12:48
I disagree.

See above.

_m

grugq
April 22nd, 2001, 08:09
I agree wtih above.

peace,

grugq

Latigo
April 22nd, 2001, 10:11
Thanks again to everyone for your info!

Latigo