You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Kamesh Jayachandran <ka...@collab.net> on 2008/01/08 15:41:58 UTC

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

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@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

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

Posted by Kamesh Jayachandran <ka...@collab.net>.
C. Michael Pilato wrote:
> Kamesh Jayachandran wrote:
>   
>> 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.
>>     
>
> There are no shortage of uses like this in the codebase:
>
>    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));
>
> Also, you could shorted the name of the 'reflective_rev_affected_paths'
> variable.
>
>   

Thanks Mike.

With regards
Kamesh Jayachandran

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

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

Posted by "C. Michael Pilato" <cm...@collab.net>.
Kamesh Jayachandran wrote:
> 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.

There are no shortage of uses like this in the codebase:

   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));

Also, you could shorted the name of the 'reflective_rev_affected_paths'
variable.

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand