JavaScript:SpiderMonkey:C Coding Style: Difference between revisions

m
Line 39: Line 39:
= Whitespace in declarations =
= Whitespace in declarations =
These rules are inconsistently applied.  Be consistent with the code you're editing rather than adhere too closely to these guidelines!
These rules are inconsistently applied.  Be consistent with the code you're editing rather than adhere too closely to these guidelines!
* In a declaration of a pointer, the <code>*</code> goes with the variable name:
* In a declaration of a pointer, the <code>*</code> goes with the variable name:
  char* s;                  /* bad */
  char* s;                  /* bad */
Line 58: Line 59:
  extern JSString * JS_FASTCALL          /* OK */
  extern JSString * JS_FASTCALL          /* OK */
  js_ConcatStrings(JSContext *cx, JSString *left, JSString *right);
  js_ConcatStrings(JSContext *cx, JSString *left, JSString *right);
* In C++ method declarations with default arguments, use spaces and comments like so:
static void
Frob(JSContext *cx, uint32_t defaultValue = 0);
static void
Frob(JSContext *cx, uint32_t defaultValue /* = 0 */)
{
    /* ... */
}


= Other whitespace =
= Other whitespace =
Confirmed users
446

edits