Re: Which code style do you prefer the most?

Liste des GroupesRevenir à cl c 
Sujet : Re: Which code style do you prefer the most?
De : already5chosen (at) *nospam* yahoo.com (Michael S)
Groupes : comp.lang.c
Date : 28. Feb 2025, 15:34:53
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250228163453.000038a0@yahoo.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
User-Agent : Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)
On Fri, 28 Feb 2025 14:22:05 +0000
bart <bc@freeuk.com> wrote:

On 28/02/2025 10:19, Richard Heathfield wrote:
On 28/02/2025 09:21, Janis Papanagnou wrote: 
On 28.02.2025 09:55, Richard Heathfield wrote: 
<snip> 
 
On the other hand, I maxed out at 24. 
>
It would be interesting to get to know what sort of code-lines
or what sort of code-structure these extreme values stem from. 
 
I thought so too, so I looked, and of course it's not as
interesting as we might have hoped.
 
I'm not allowed to post the code here, but I can paraphrase:
 
   value = really_quite_extremely_long_function_name(arg1,
                                                     arg2,
                                                     arg3,
                                                     arg4);
 
<sigh>
 
 
I think I'd go with this:
 
     value = really_quite_extremely_long_function_name(
         arg1,
         arg2,
         arg3,
         arg4);
 

Same here. Except that I'd use even smaller indentation.

But not for printf(). For printf I prefer
  printf("short format %d+%d+%d=%d\n"
    ,arg1
    ,arg2
    ,arg3
    ,arg4
  );

When format string is longer I put it on the separate line as well.


Since the args would then also line up with a similar call but where
the function name is a different length:
 
     value2 = a_somewhat_shorter_function_name(
         arg1,
         arg2,
         arg3,
         arg4);
 
That's assuming it is still not viable to have them all on the same
line.



Date Sujet#  Auteur
28 Mar 26 o 

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal