public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* Coding style questions
@ 2009-12-05  2:19 Radu Voicilas
  2009-12-14 19:01 ` Davidlohr Bueso
  0 siblings, 1 reply; 2+ messages in thread
From: Radu Voicilas @ 2009-12-05  2:19 UTC (permalink / raw)
  To: kernel-janitors

1. When you have a function prototype with a comment following it (which obviously it's a bad thing), like this one

u32 eprom_read(struct net_device *dev,u32 addr); //reads a 16 bits word

and want to fix it, how would one do it:

/* Read a 16 bits word. */
u32 eprom_read(struct net_device *dev, u32 addr);

or the comment should go into the implementation file ?

2. What's the kernel code style about header guards ? As far as I've seen, it's usual to do:

#ifndef HEADER_H
#define HEADER_H

and not:

#infdef _HEADER_H
#define _HEADER_H

or other variations. Does it even matter?


Thanks,
Radu.

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

* Re: Coding style questions
  2009-12-05  2:19 Coding style questions Radu Voicilas
@ 2009-12-14 19:01 ` Davidlohr Bueso
  0 siblings, 0 replies; 2+ messages in thread
From: Davidlohr Bueso @ 2009-12-14 19:01 UTC (permalink / raw)
  To: kernel-janitors

On Fri, Dec 04, 2009 at 06:19:29PM -0800, Radu Voicilas wrote:
> 1. When you have a function prototype with a comment following it (which obviously it's a bad thing), like this one
> 
> u32 eprom_read(struct net_device *dev,u32 addr); //reads a 16 bits word
> 
> and want to fix it, how would one do it:
> 
> /* Read a 16 bits word. */
> u32 eprom_read(struct net_device *dev, u32 addr);
> 
> or the comment should go into the implementation file ?
It should go in the implementation file, but common sense is always best.
Be sure to read Documentation/CodingStyle.

   Davidlohr

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

end of thread, other threads:[~2009-12-14 19:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-05  2:19 Coding style questions Radu Voicilas
2009-12-14 19:01 ` Davidlohr Bueso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox