Confirmed users
446
edits
m (add whitespace) |
m (note for-loop newlines) |
||
| Line 74: | Line 74: | ||
= Other whitespace = | = Other whitespace = | ||
* There used to be a strict | * There used to be a strict 79-column limit per line. The hard limit is now 99 columns, a change that dates to 2008. Break down lines that are too long. | ||
** Overlong conditions break after each && or || operator. | ** Overlong conditions break after each && or || operator. | ||
** Other binary operators go at the front of the second line. | ** Other binary operators go at the front of the second line. | ||
| Line 102: | Line 102: | ||
CallThisMethod(argument1, | CallThisMethod(argument1, | ||
argument2); | argument2); | ||
} | |||
* <code>for</code> loop heads go on one line where possible; when not possible, initializer part, update, and termination parts each go on separate lines | |||
for (int i = 0; | |||
i < 5; | |||
i++) { /* bad, could all fit on one line */ | |||
doStuff(); | |||
} | |||
for (int i = 0; i < 5; i++) /* OK */ | |||
doStuff(); | |||
for (size_t ind = JSObject::JSSLOT_DATE_COMPONENTS_START; | |||
ind < JSObject::DATE_FIXED_RESERVED_SLOTS; ind++) { /* bad */ | |||
obj->setSlot(ind, DoubleValue(utcTime)); | |||
} | |||
for (size_t ind = JSObject::JSSLOT_DATE_COMPONENTS_START; | |||
ind < JSObject::DATE_FIXED_RESERVED_SLOTS; | |||
ind++) { /* OK */ | |||
obj->setSlot(ind, DoubleValue(utcTime)); | |||
} | } | ||