JavaScript:SpiderMonkey:C++ Coding Style: Difference between revisions

Jump to navigation Jump to search
(→‎Classical OOP: Added inline style.)
Line 15: Line 15:
* Compile-time-evaluated functions (i.e., template meta-functions) are kept in the "template library" namespace to avoid collision with their runtime counterparts.
* Compile-time-evaluated functions (i.e., template meta-functions) are kept in the "template library" namespace to avoid collision with their runtime counterparts.
  namespace js { namespace tl { ... } }
  namespace js { namespace tl { ... } }
* Avoid unnamed namespaces unless they are necessary to give a class's members internal linkage.  Although the C++ standard officially deprecates 'static' on  functions, 'static' has the following advantages:
** It is difficult to name functions in unnamed namespaces in gdb.
** Static says "this is a translation-unit-local helper function" on the function, without having to look around for an enclosing "namespace {".
* Other namespaces? Are these names too short and likely to collide?
* Other namespaces? Are these names too short and likely to collide?


Confirmed users
367

edits

Navigation menu