|
|
Log in / Subscribe / Register

Kernel prepatch 3.11-rc4

Kernel prepatch 3.11-rc4

Posted Aug 5, 2013 23:24 UTC (Mon) by xtifr (guest, #143)
In reply to: Kernel prepatch 3.11-rc4 by kalvdans
Parent article: Kernel prepatch 3.11-rc4

Wow, do the kernel standards not support/require inlines for cases like this? Inline has been available in gcc for god-knows-how-long, and has been part of the C standard since C99.

inline int is_gate_vma(whatever* vma) { return vma = &gate_vma; }

This should get a compile-time error, since it's not returning an int/bool, or at the very least, a stern warning, and possibly another warning, since it only modifies a local variable. (To actually do an assignment, you'd have to pass a pointer to the pointer.)

The macro version, by contrast, will suppress any warning the compiler might issue, because it includes the extra parens that tell gcc this sort of thing is ok--and has to include those extra parens. Macros may be *less* evil in C than in C++, but they're still something I prefer to avoid when I can.


to post comments

Kernel prepatch 3.11-rc4

Posted Aug 6, 2013 7:30 UTC (Tue) by kugel (subscriber, #70540) [Link]

Good point. It should have been an inline in the first place.

Kernel prepatch 3.11-rc4

Posted Aug 7, 2013 11:18 UTC (Wed) by cesarb (subscriber, #6266) [Link]

Why do we have to keep using int as if it were bool? Why not "inline bool is_gate_vma(...)" instead of "inline int is_gate_vma(...)"?


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds