* query about use of IFDEFS
@ 2001-11-02 13:36 Manik Raina
2001-11-02 21:30 ` Robert Love
0 siblings, 1 reply; 2+ messages in thread
From: Manik Raina @ 2001-11-02 13:36 UTC (permalink / raw)
To: linux-kernel
hi,
which of the following be acceptable in the linux kernel ?
1. first choice, you've put the static inline in the header
---------------------------------------
foo.h:
#ifdef CONFIG_BAR
void foo_init(void);
#else
static void __inline__ foo_init(void);
foo.c:
#ifdef CONFIG_BAR
void foo_init(void)
{
do_some_stuff_here();
}
#else
#endif
2. you've left the conditional compilation only in the .c file
----------------------------------------
foo.h:
void foo_init(void);
foo.c:
void foo_init (void)
{
#ifdef CONFIG_BAR
do_some_stuff_here();
#else
#endif
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: query about use of IFDEFS
2001-11-02 13:36 query about use of IFDEFS Manik Raina
@ 2001-11-02 21:30 ` Robert Love
0 siblings, 0 replies; 2+ messages in thread
From: Robert Love @ 2001-11-02 21:30 UTC (permalink / raw)
To: Manik Raina; +Cc: linux-kernel
On Fri, 2001-11-02 at 08:36, Manik Raina wrote:
> which of the following be acceptable in the linux kernel ?
> [...]
The first. You want the code itself to be clean and clear; free of
ifdefs.
So in your header files you ifdef as needed. The simplest example of
this would be with a define:
#ifdef CONFIG_SMP
#define special_smp_thing() whatever_smp()
#else
#define special_smp_thing()
#endif
Robert Love
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-11-02 21:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-11-02 13:36 query about use of IFDEFS Manik Raina
2001-11-02 21:30 ` Robert Love
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox