Re: macro or inline

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi..

On Mon, Aug 23, 2010 at 17:39, Parmenides <mobile.parmenides@xxxxxxxxx> wrote:
> Hi,
>
> In kernel, some codes implemented by macro while the others by inline
> function.  I wonder how to determine in what situation to use one,
> whereas in what situation to use the other.

Just adding...

IMHO, you use "inline" if you plan to "insert" codes which is quite
long....so that in term of readability's point of view, it's easier to
read.

Just think by yourself, what happen if you met this kind of macro
(excuse me for some errors :D :D ):
#define iwonderwhy do {
i_need_to_do_this;
i++;
y++;
i_need_to_do_that;
and_another_that;
yet_another_that;
i_promise_this_is_the_end;
i_change_my_mind_again;
ok_here_is_the_end;
i=0
y=0
__repeat_the_above_steps_ten_times_explicitly
__great_i_gave_up
} while 0;



-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux