[OT] C++ tips for a D programmer
Paulo Pinto
pjmlp at progtools.org
Wed Aug 31 04:34:35 PDT 2011
Hi,
assuming that you are not working on a legacy code base, which might bring
its
own set of quirks.
Use the standard library as much as possible. Later on you can always
optimize
with help of a profiler.
Avoid C strings, prefer the standard library one.
Don't scatter new/malloc and delete/free everywhere. Keep a proper
allocation patter,
or better yet, used shared pointers in the code parts where performace hit
won't matter.
Make good use of forward declarations and PIMPL edioms to speed up
compilation speed.
Always compile with all warnings enabled, or enabled as error. Disable the
false positives
in places you are sure what you're doing.
My C++ language reference is always Bjarne's book,
The C++ programming language
but there a few other ones worthwhile reading
Modern C++ Design: Generic Programming and Design Patterns Applied
Effective C++ series
The Design and Evolution of C++
Accelerated C++: Practical Programming by Example
Ruminations on C++: A Decade of Programming Insight and Experience
Good luck on your new job,
Paulo
"Lars T. Kyllingstad" <public at kyllingen.NOSPAMnet> wrote in message
news:j3ksua$2nv2$1 at digitalmars.com...
>I am starting in a new job on Monday, in which the primary programming
> language is C++. For the past four years I've had the privilege of being
> able to use D both professionally and privately, and consequently my C++
> skills (which were intermediate to begin with) are now a bit rusty.
>
> Since I know there are a lot of extremely talented C++ programmers in the
> D community, I thought I'd ask here for some tips.
>
> Firstly, can you think of any pitfalls to avoid? In particular, I am
> interested in the ones that stem from subtle differences between the two
> programming languages. I believe I am already aware of the most obvious
> stuff (such as for example array bounds checking, or lack thereof).
>
> Secondly, can you recommend a good C++ book? I am looking for one that
> targets an audience with good general programming skills, and which can
> act as a language reference.
>
> Hopefully, my adventures in the world of C++ will give me new
> perspectives on things, allowing me to contribute even better to the
> improvement of D. ;)
>
> -Lars
More information about the Digitalmars-d
mailing list