Skip to contentSkip to conversation

How to change long C comment lines for a single statement

DISCUSSION R Veera Kumar 3 participants 3 messages Mar 19, 2020

lore
Share & tools
lore
#0 lore raw

Hi,

How to change long C comment lines for a single statement or a C header define as per linux kernel coding style.

E.g.

abc (xyz(), "str"); /* This is example function call with a long line comment */

which is okay:

abc (xyz(), "str"); /* This is example function call with a
long line comment */

abc (xyz(), "str"); /* This is example function call with a
long line comment */

	abc (xyz(), "str");
	/* This is example function call with a long line comment */

	abc (xyz(), "str"); /*
			     * This is example function call with a
			     * long line comment
			     */

	abc (xyz(), "str");
		/*
		 * This is example function call with a
		 * long line comment
		 */

Regards,
Veera

#1 lore raw
Quoted 17 lines · R Veera Kumar

Hi,

How to change long C comment lines for a single statement or a C header define as per linux kernel coding style.

E.g.

abc (xyz(), "str"); /* This is example function call with a long line comment */

which is okay:

abc (xyz(), "str"); /* This is example function call with a
long line comment */

abc (xyz(), "str"); /* This is example function call with a
long line comment */

Quoted 13 lines
	abc (xyz(), "str");
	/* This is example function call with a long line comment */

	abc (xyz(), "str"); /*
			     * This is example function call with a
			     * long line comment
			     */

	abc (xyz(), "str");
		/*
		 * This is example function call with a
		 * long line comment
		 */

I haven't done an extensive study on the question, but intuitively putting the comment before the call would mke sense.

julia

#2 lore raw
In reply to R Veera Kumar
Quoted 17 lines · R Veera Kumar

Hi,

How to change long C comment lines for a single statement or a C header define as per linux kernel coding style.

E.g.

abc (xyz(), "str"); /* This is example function call with a long line comment */

which is okay:

abc (xyz(), "str"); /* This is example function call with a
long line comment */

abc (xyz(), "str"); /* This is example function call with a
long line comment */

Quoted 13 lines
	abc (xyz(), "str");
	/* This is example function call with a long line comment */

	abc (xyz(), "str"); /*
			     * This is example function call with a
			     * long line comment
			     */

	abc (xyz(), "str");
		/*
		 * This is example function call with a
		 * long line comment
		 */

None of those is the "best" way, that would be:
/* This is example function call with a long line comment */ abc (xyz(), "str");

There are hundreds of thousands of examples of this in the kernel source tree to look at for inspiration :)

thanks,

greg k-h