Re: [PATCH net-next 3/5] r8152: add MCU typed read/write functions

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

 



On Thu, 5 Nov 2020 12:56:42 +0200
Vladimir Oltean <olteanv@xxxxxxxxx> wrote:

> On Thu, Nov 05, 2020 at 10:54:18AM +0100, Marek Behún wrote:
> > I thought that static inline functions are preferred to macros, since
> > compiler warns better if they are used incorrectly...  
> 
> Citation needed.

Just search for substring "instead of macro" in git log, there are
multiple such changes that were accepted since it provides better
typechecking. I am not saying it is documented anywhere, just that I
thought it was preffered.

> Also, how do static inline functions wrapped in macros
> (i.e. your patch) stack up against your claim about better warnings?

If they are defined as functions (they don't have to be inline,
of course) instead of macros and they are used incorrectly, the compiler
provides more readable warnings. (Yes, in current versions of gcc it is
much better than in the past, but still there are more lines of
warnings printed: "in expansion of macro"...).


> I guess ease of maintainership should prevail here, and Hayes should
> have the final word. I don't really have any stake here.

Vladimir, your arguments are valid and I accept the reasoning.
I too can see that the resulting code is a little awkward.

Marek






[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux