Log in

No account? Create an account

The Least-Common-Denominator is really least-y....

Always interested in writing better code, I was perusing this C++ Portability Guide for Mozilla developers.

The best recommendations for writing C++ code that will compile on most C++ compilers include:

  • Don't use exceptions
  • Don't use the standard template library
  • Don't use namespaces
  • Some compilers require that variables which need a constructor or initializer be declared at the start of the method
  • Don't inline functions in the expression for a return value

You can drive my car, but I'd prefer that you not use the anti-lock brakes, seat belts, air bags, cup holders, rear-view mirror, sun visor, cassette deck, seat adjustments, and automatic transmission. These are all somewhat recent features that aren't supported on all vehicles.

C++ is unsafe at any speed.