To reduce the length of lines, I sometimes like to format function calls like this:
| int value = longFunctionName(
longArgumentName,
evenLongerArgument,
seriouslyWhyAreThoseNamesSoVerbose
);
|
(I suppose the closing parenthesis could also be on the same line as the last argument, whichever you prefer.)
Similarly for function declarations:
| static int
functionName(
int arg1,
int arg2
) {
// Function body
}
|
I actually use this format for
all function declarations, not just long ones. It takes a bit to get used to, but has some advantages. First, the return type is clearly separated from the function name, on its own line (with the optional static). Second, each argument is on its own line so the eyes don't have to hunt for the commas to parse them. This makes it easier to tell at a glance how many arguments a function expects and what their types are. Adding, removing and reordering arguments is easier as well, since most text editors have quick and easy operations for removing, inserting and moving lines around.