wtorek, 11 sierpnia 2009

C++ main disfunctions

In my opinion there are two main disadvantages of C++:
  1. lack of local functions (called sometimes "nested")
  2. lack of pointers to class method ("delegates")
Ad 1. GotW #58 shows use of local class to simulate local functions, but this is partial solution - class has no direct access to objects existing in outer scope. This force programmer to manage many things manually (more work) and is place of potential error.

Ad 2. Borland has __closure extension (no portable code), there are some portable libraries that does the trick. But everything is not compatible with each other, we can forget about real code reuse.