Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I love your metaphor! What Stroustrup actually said was:</p> <p><a href="http://en.wikiquote.org/wiki/Bjarne_Stroustrup" rel="nofollow noreferrer">http://en.wikiquote.org/wiki/Bjarne_Stroustrup</a></p> <blockquote> <p>C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off.</p> </blockquote> <p>This was many years ago. I started learning C++ in ca. 1991 and it really was a minefield. There were no common libraries, no debuggers and the AT&amp;T approach used a C code generator. There are now many good IDEs which support C++.</p> <p>Personally I moved to Java because I find it a cleaner language but C++ is fine as long as you don't try to be tricky. Avoid native C constructs where there are existing class libraries (Stroustrup initially did not provide a String class as he though it a useful "rite of passage" to have to write one!) Now you can use a proven one.</p> <p>I'm assuming you have no choice in the language. How you go about it depends on where you are coming from. C++ is not the easiest of the object-oriented languages to start on and Stroustrup's book is not necessarily the best intro.</p> <p><strong>UPDATE</strong> the OP is worried about blowing themselves up when <em>learning</em> the language. Generally it's a good idea to start with a subset of what one will do later. I assumed the OP is worried about:</p> <ul> <li>Things which you have to know and use whatever level you program at (such as destructors)</li> <li>Things which add additional complexity to the learning process and can be shelved until later (such as multiple inheritance)</li> </ul> <p>what follows are some places where I blew myself up... They are not subjective, they happened!</p> <p>There are some up-front gotchas that don't exist in Java or C#.</p> <ul> <li>destructors. You have to manage your own memory. Failing to write destructors will blow your fingers and toes off.</li> <li>equality. You will have to write an equals method (in simple Java you may get away without it)</li> <li>copy constructor. Ditto. <code>a = b</code> will invoke this. Bites you in the bottom.</li> </ul> <p>And I'd suggest avoiding multiple inheritance unless you really need it. Then avoid it anyway.</p> <p>And avoid operator overloading. It looks cute to write:</p> <pre><code>vector1 = vector2 + vector3; </code></pre> <p>but </p> <pre><code>vector1 = vector2.plus(vector3); </code></pre> <p>is just as clear, only a few more characters, and you can search for it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload