[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

How to format longish function call with very long single parameter?

From: Kamesh Jayachandran <kamesh_at_collab.net>
Date: Tue, 08 Jan 2008 21:11:58 +0530

Hi All,

Consider the following example,

SVN_ERR(svn_client_diff_summarize_peg2(target_url, &peg_revision,
                                       &opt_revision1, &opt_revision2,
                                       depth,
                                       merge_b->ignore_ancestry,
                                       get_diff_summary_func_cb,
                                       merge_b->reflective_rev_affected_paths,
                                       merge_b->ctx,
                                       iterpool));

In this example we may get past the 79 character limit.

We can format it like the following.

Format style 1: Left Justified arguments trying to be as close to
function call brackets.(Left justification point is determined by
longest of parameters).

SVN_ERR(svn_client_diff_summarize_peg2(target_url, &peg_revision,
                                    &opt_revision1, &opt_revision2,
                                    depth,
                                    merge_b->ignore_ancestry,
                                    get_diff_summary_func_cb,
                                    merge_b->reflective_rev_affected_paths,
                                    merge_b->ctx,
                                    iterpool));

Format style 2: Left Justified at 2 characters indentation from function
name start.

SVN_ERR(svn_client_diff_summarize_peg2(target_url, &peg_revision,
          &opt_revision1, &opt_revision2,
          depth,
          merge_b->ignore_ancestry,
          get_diff_summary_func_cb,
          merge_b->reflective_rev_affected_paths,
          merge_b->ctx,
          iterpool));

I like Format Style 1 as I could see all the arguments closer including
the first line arguments.

Format style 2 looks closer to our style of longish assignment
statements. (int looooooooooooongish_name =
                                                                                                                            
looooooooooooonggggggg_func_name(blahhhhhhhhhhhhhhhhhhhhhhhh);

**

I would like to know what others feel on this.

With regards
Kamesh Jayachandran

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-01-08 16:48:53 CET

This is an archived mail posted to the Subversion Dev mailing list.