outreachy.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* Request for assistance
@ 2022-10-20 11:00 Ubuntu
  2022-10-20 11:10 ` Greg KH
       [not found] ` <CAOkYk0iU0B98JsH77avky--AS19V=GhQox2f_b4PAG3ZBB+SVQ@mail.gmail.com>
  0 siblings, 2 replies; 11+ messages in thread
From: Ubuntu @ 2022-10-20 11:00 UTC (permalink / raw)
  To: linux-staging, linux-kernel, outreachy

Hello,
I have a diffictly deciding where exactly to split a long line of code. for example, this line of code is too long

uCTSTime = bb_get_frame_time(pDevice->preamble_type, byPktType, 14, pDevice->byTopCCKBasicRate);

if i spit it this way:
uCTSTime =
        bb_get_frame_time(pDevice->preamble_type, byPktType, 14, pDevice->byTopCCKBasicRate);

It does not help as the second line is still too long. I considered doing it this way instead:
uCTSTime = bb_get_frame_time(pDevice->preamble_type, byPktType, 14,
                                pDevice->byTopCCKBasicRate);
But i did this on one of my patches and i was told it is not advisable to split a line between
parenthesis '(' and ')'

how can i go about this please?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Request for assistance
  2022-10-20 11:00 Request for assistance Ubuntu
@ 2022-10-20 11:10 ` Greg KH
  2022-10-20 11:14   ` Tanju Brunostar
       [not found] ` <CAOkYk0iU0B98JsH77avky--AS19V=GhQox2f_b4PAG3ZBB+SVQ@mail.gmail.com>
  1 sibling, 1 reply; 11+ messages in thread
From: Greg KH @ 2022-10-20 11:10 UTC (permalink / raw)
  To: Ubuntu; +Cc: linux-staging, linux-kernel, outreachy

On Thu, Oct 20, 2022 at 11:00:59AM +0000, Ubuntu wrote:
> Hello,
> I have a diffictly deciding where exactly to split a long line of code. for example, this line of code is too long
> 
> uCTSTime = bb_get_frame_time(pDevice->preamble_type, byPktType, 14, pDevice->byTopCCKBasicRate);
> 
> if i spit it this way:
> uCTSTime =
>         bb_get_frame_time(pDevice->preamble_type, byPktType, 14, pDevice->byTopCCKBasicRate);
> 
> It does not help as the second line is still too long. I considered doing it this way instead:
> uCTSTime = bb_get_frame_time(pDevice->preamble_type, byPktType, 14,
>                                 pDevice->byTopCCKBasicRate);
> But i did this on one of my patches and i was told it is not advisable to split a line between
> parenthesis '(' and ')'

Who told you that?

You are close, the code should look like:
	uCTSTime = bb_get_frame_time(pDevice->preamble_type, byPktType, 14,
				     pDevice->byTopCCKBasicRate);

Like millions of other lines in the kernel source tree.  When in doubt,
look at existing implementations.

hope this helps,

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Request for assistance
  2022-10-20 11:10 ` Greg KH
@ 2022-10-20 11:14   ` Tanju Brunostar
  2022-10-20 11:59     ` Julia Lawall
  0 siblings, 1 reply; 11+ messages in thread
From: Tanju Brunostar @ 2022-10-20 11:14 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-staging, linux-kernel, outreachy

On Thu, Oct 20, 2022 at 12:10 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Thu, Oct 20, 2022 at 11:00:59AM +0000, Ubuntu wrote:
> > Hello,
> > I have a diffictly deciding where exactly to split a long line of code. for example, this line of code is too long
> >
> > uCTSTime = bb_get_frame_time(pDevice->preamble_type, byPktType, 14, pDevice->byTopCCKBasicRate);
> >
> > if i spit it this way:
> > uCTSTime =
> >         bb_get_frame_time(pDevice->preamble_type, byPktType, 14, pDevice->byTopCCKBasicRate);
> >
> > It does not help as the second line is still too long. I considered doing it this way instead:
> > uCTSTime = bb_get_frame_time(pDevice->preamble_type, byPktType, 14,
> >                                 pDevice->byTopCCKBasicRate);
> > But i did this on one of my patches and i was told it is not advisable to split a line between
> > parenthesis '(' and ')'
>
> Who told you that?
>
> You are close, the code should look like:
>         uCTSTime = bb_get_frame_time(pDevice->preamble_type, byPktType, 14,
>                                      pDevice->byTopCCKBasicRate);
>
> Like millions of other lines in the kernel source tree.  When in doubt,
> look at existing implementations.
>
> hope this helps,
>
> greg k-h
Thank you for the clarification

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Request for assistance
       [not found] ` <CAOkYk0iU0B98JsH77avky--AS19V=GhQox2f_b4PAG3ZBB+SVQ@mail.gmail.com>
@ 2022-10-20 11:34   ` Tanju Brunostar
  2022-10-20 12:10     ` Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Tanju Brunostar @ 2022-10-20 11:34 UTC (permalink / raw)
  To: Bhaskar Chowdhury; +Cc: linux-kernel, linux-staging, outreachy

On Thu, Oct 20, 2022 at 12:27 PM Bhaskar Chowdhury
<unixbhaskar@gmail.com> wrote:
>
> Use forward slash at the end every single chunk or piece of that line.
>
> Example :
>
> Veryyyyyyylooooooong. Linerrrrrrrrrrrrrrr
>
> Veryyyyyyyyyyyyy /
>
> Looooonggggggggg /
>
>
> Linerrrrrrrrrrr /
>
Thanks

>
> On Thu, 20 Oct 2022 at 16:43, Ubuntu <tanjubrunostar0@gmail.com> wrote:
>>
>> Hello,
>> I have a diffictly deciding where exactly to split a long line of code. for example, this line of code is too long
>>
>> uCTSTime = bb_get_frame_time(pDevice->preamble_type, byPktType, 14, pDevice->byTopCCKBasicRate);
>>
>> if i spit it this way:
>> uCTSTime =
>>         bb_get_frame_time(pDevice->preamble_type, byPktType, 14, pDevice->byTopCCKBasicRate);
>>
>> It does not help as the second line is still too long. I considered doing it this way instead:
>> uCTSTime = bb_get_frame_time(pDevice->preamble_type, byPktType, 14,
>>                                 pDevice->byTopCCKBasicRate);
>> But i did this on one of my patches and i was told it is not advisable to split a line between
>> parenthesis '(' and ')'
>>
>> how can i go about this please?
>
> --
>
>
> Bhaskar Chowdhury
> about.me/unixbhaskar

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Request for assistance
  2022-10-20 11:14   ` Tanju Brunostar
@ 2022-10-20 11:59     ` Julia Lawall
  0 siblings, 0 replies; 11+ messages in thread
From: Julia Lawall @ 2022-10-20 11:59 UTC (permalink / raw)
  To: Tanju Brunostar; +Cc: Greg KH, linux-staging, linux-kernel, outreachy



On Thu, 20 Oct 2022, Tanju Brunostar wrote:

> On Thu, Oct 20, 2022 at 12:10 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > On Thu, Oct 20, 2022 at 11:00:59AM +0000, Ubuntu wrote:
> > > Hello,
> > > I have a diffictly deciding where exactly to split a long line of code. for example, this line of code is too long
> > >
> > > uCTSTime = bb_get_frame_time(pDevice->preamble_type, byPktType, 14, pDevice->byTopCCKBasicRate);
> > >
> > > if i spit it this way:
> > > uCTSTime =
> > >         bb_get_frame_time(pDevice->preamble_type, byPktType, 14, pDevice->byTopCCKBasicRate);
> > >
> > > It does not help as the second line is still too long. I considered doing it this way instead:
> > > uCTSTime = bb_get_frame_time(pDevice->preamble_type, byPktType, 14,
> > >                                 pDevice->byTopCCKBasicRate);
> > > But i did this on one of my patches and i was told it is not advisable to split a line between
> > > parenthesis '(' and ')'
> >
> > Who told you that?

I did, but the context was different.  It's fine to have a newline among
the of arguments of a function call.  It's less desirable to put a newline
in the middle of (A | B), it if can be avoided.

julia

> >
> > You are close, the code should look like:
> >         uCTSTime = bb_get_frame_time(pDevice->preamble_type, byPktType, 14,
> >                                      pDevice->byTopCCKBasicRate);
> >
> > Like millions of other lines in the kernel source tree.  When in doubt,
> > look at existing implementations.
> >
> > hope this helps,
> >
> > greg k-h
> Thank you for the clarification
>
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Request for assistance
  2022-10-20 11:34   ` Tanju Brunostar
@ 2022-10-20 12:10     ` Greg KH
  2022-10-20 14:39       ` Theodore Ts'o
  0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2022-10-20 12:10 UTC (permalink / raw)
  To: Tanju Brunostar; +Cc: Bhaskar Chowdhury, linux-kernel, linux-staging, outreachy

On Thu, Oct 20, 2022 at 12:34:02PM +0100, Tanju Brunostar wrote:
> On Thu, Oct 20, 2022 at 12:27 PM Bhaskar Chowdhury
> <unixbhaskar@gmail.com> wrote:
> >
> > Use forward slash at the end every single chunk or piece of that line.
> >
> > Example :
> >
> > Veryyyyyyylooooooong. Linerrrrrrrrrrrrrrr
> >
> > Veryyyyyyyyyyyyy /
> >
> > Looooonggggggggg /
> >
> >
> > Linerrrrrrrrrrr /

No, please do not do that in normal C code.  That's only for rare cases,
like in a #define, that this style would be needed.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Request for assistance
  2022-10-20 12:10     ` Greg KH
@ 2022-10-20 14:39       ` Theodore Ts'o
       [not found]         ` <Y1Hby38PE/QVlRhF@Slackware>
  0 siblings, 1 reply; 11+ messages in thread
From: Theodore Ts'o @ 2022-10-20 14:39 UTC (permalink / raw)
  To: Greg KH
  Cc: Tanju Brunostar, Bhaskar Chowdhury, linux-kernel, linux-staging,
	outreachy

Tanju, some additional hints.  First of all, please don't send cleanup
patches to address checkpatch --file complaints about overly long
lines.  It's generally not worth the code churn.

Secondly for code that *you* are writing, think about why you have
lines which are exceeding the line width in the first place.  Is it
because code is being nested too deeply, and perhaps some judicious
function refactoring with good function names might make the code
clearer?  Would adding some temporary variables that are judiciously
named make the code look clearer?

The rules about "thou shalt never have lines which exceed 78
characters" are rules of thumb.  The high level goal is to make the
code more readable and easier to understand, since good code is
maintainable code.  And sometimes it's not just about where to split
lines of code but whether there is a better way to structure the code
so that long lines aren't needed in the first place.

Cheers,

					- Ted

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Request for assistance
       [not found]         ` <Y1Hby38PE/QVlRhF@Slackware>
@ 2022-10-21  6:11           ` Tanju Brunostar
  0 siblings, 0 replies; 11+ messages in thread
From: Tanju Brunostar @ 2022-10-21  6:11 UTC (permalink / raw)
  To: Bhaskar Chowdhury, Theodore Ts'o, Greg KH, Tanju Brunostar,
	linux-kernel, linux-staging, outreachy

On Fri, Oct 21, 2022 at 12:38 AM Bhaskar Chowdhury
<unixbhaskar@gmail.com> wrote:
>
> On 10:39 Thu 20 Oct 2022, Theodore Ts'o wrote:
> >Tanju, some additional hints.  First of all, please don't send cleanup
> >patches to address checkpatch --file complaints about overly long
> >lines.  It's generally not worth the code churn.
> >
> >Secondly for code that *you* are writing, think about why you have
> >lines which are exceeding the line width in the first place.  Is it
> >because code is being nested too deeply, and perhaps some judicious
> >function refactoring with good function names might make the code
> >clearer?  Would adding some temporary variables that are judiciously
> >named make the code look clearer?
> >
> >The rules about "thou shalt never have lines which exceed 78
> >characters" are rules of thumb.  The high level goal is to make the
> >code more readable and easier to understand, since good code is
> >maintainable code.  And sometimes it's not just about where to split
> >lines of code but whether there is a better way to structure the code
> >so that long lines aren't needed in the first place.
> >
> >Cheers,
> >
> >                                       - Ted
> Righto!! I failed to miss it my replies. That an editor can be trained or
> customized to that way. Especially , vim and emacs.
> --
> Thanks,
> Bhaskar
>
> "Here's looking at you kid"-- Casablanca
> https://about.me/unixbhaskar
I appreciate all your replies. They have been quite helpful. I will
try to apply them as I continue on my journey of contributing to the
kernel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* request for assistance
@ 2022-10-22  8:11 Tanju Brunostar
  2022-10-22  8:13 ` Julia Lawall
  0 siblings, 1 reply; 11+ messages in thread
From: Tanju Brunostar @ 2022-10-22  8:11 UTC (permalink / raw)
  To: linux-staging, linux-kernel, outreachy

There is a portion of the Outreachy first patch wiki I would like to
edit. How do I go about doing this?
- Should I just go on and edit it? or
- Do I have to make a proposition addressed to someone or somewhere,
stating what it is I want to change and why?
I would appreciate your help.
thanks

Tanju

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: request for assistance
  2022-10-22  8:11 request " Tanju Brunostar
@ 2022-10-22  8:13 ` Julia Lawall
  2022-10-22  8:20   ` Tanju Brunostar
  0 siblings, 1 reply; 11+ messages in thread
From: Julia Lawall @ 2022-10-22  8:13 UTC (permalink / raw)
  To: Tanju Brunostar; +Cc: linux-staging, linux-kernel, outreachy



On Sat, 22 Oct 2022, Tanju Brunostar wrote:

> There is a portion of the Outreachy first patch wiki I would like to
> edit. How do I go about doing this?
> - Should I just go on and edit it? or
> - Do I have to make a proposition addressed to someone or somewhere,
> stating what it is I want to change and why?
> I would appreciate your help.

It would be good to post your proposed changes to the mailing list, if it
is something more substantial than fixing a spelling mistake.

julia

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: request for assistance
  2022-10-22  8:13 ` Julia Lawall
@ 2022-10-22  8:20   ` Tanju Brunostar
  0 siblings, 0 replies; 11+ messages in thread
From: Tanju Brunostar @ 2022-10-22  8:20 UTC (permalink / raw)
  To: Julia Lawall; +Cc: linux-staging, linux-kernel, outreachy

On Sat, Oct 22, 2022 at 9:13 AM Julia Lawall <julia.lawall@inria.fr> wrote:
>
>
>
> On Sat, 22 Oct 2022, Tanju Brunostar wrote:
>
> > There is a portion of the Outreachy first patch wiki I would like to
> > edit. How do I go about doing this?
> > - Should I just go on and edit it? or
> > - Do I have to make a proposition addressed to someone or somewhere,
> > stating what it is I want to change and why?
> > I would appreciate your help.
>
> It would be good to post your proposed changes to the mailing list, if it
> is something more substantial than fixing a spelling mistake.
>
> julia

Ok Thanks

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-10-22  8:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-20 11:00 Request for assistance Ubuntu
2022-10-20 11:10 ` Greg KH
2022-10-20 11:14   ` Tanju Brunostar
2022-10-20 11:59     ` Julia Lawall
     [not found] ` <CAOkYk0iU0B98JsH77avky--AS19V=GhQox2f_b4PAG3ZBB+SVQ@mail.gmail.com>
2022-10-20 11:34   ` Tanju Brunostar
2022-10-20 12:10     ` Greg KH
2022-10-20 14:39       ` Theodore Ts'o
     [not found]         ` <Y1Hby38PE/QVlRhF@Slackware>
2022-10-21  6:11           ` Tanju Brunostar
  -- strict thread matches above, loose matches on Subject: below --
2022-10-22  8:11 request " Tanju Brunostar
2022-10-22  8:13 ` Julia Lawall
2022-10-22  8:20   ` Tanju Brunostar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).