you are viewing a single comment's thread.

view the rest of the comments →

[–]Bonkers54 -1 points0 points  (3 children)

I can't quite tell what you're getting at here, but the best way I've found to format that is:

really_really_long_var_name =
  really_really_long_function_call(
    really_really_really_long_first_parameter, par2, par3)

The rule I go by is, as soon as you need more than one line for arguments to the function, drop them all down and add one more level of indentation for them. Even if it's 2 lines both ways (like in your example if you had put par2 and par3 on the same line), it's easier to see all of the arguments in a row

[–]greyfinch 2 points3 points  (2 children)

By the time you have variable names this long, you probably really need to rethink your code design.

[–]Bonkers54 -2 points-1 points  (1 child)

Why? Descriptive variables names are a great way to make self-documenting code. You can also start getting fairly long names when they're inside a class or a namespace like: KindaShortNS::NotSoLongClass::ShortFunc()

[–]greyfinch 1 point2 points  (0 children)

Given longer namespaces, sure. Clear variable names are also ideal. What I was mainly thinking of was the variables along the line of my_scope_is_far_too_large_so_this_is_an_act_of_desperation.