C++ Traps (for the Java Programmer)

I've been a Java programmer since 1997 when I first picked it up in college (and made a bytecode-to-bytecode optimizer for it), but now I finally have to delve into the strange rat's nest that is C++.  As a preparation, I started reading through The C++ Programming Language, noting what things were unexpectedly different from Java. For two languages with such a close ancestry, there are surprisingly many.
  • The line Foo x; actually constructs an object, including calling the constructor. The object dies quietly at the end of the scope, though, even if you pass it to functions.
  • The statement foo = bar; may or may not make a copy of bar. You can't tell without looking carefully at types and constructors.
  • An object can be held in three different ways: Pointer, reference or bare object.  The access syntax is different between pointer and the two other. Both pointers and references can disappear out from under your feet when you leave a scope.
[Many more on a piece of paper at home...]

Of course, there are many traps in C++ that are not particularly Java-oriented:
  • "structs are like classes without methods" - except new MyStruct doesn't initialize it.  new MyStruct() might.