|
|
Subscribe / Log in / New account

C, still?

C, still?

Posted Sep 20, 2017 12:31 UTC (Wed) by eru (subscriber, #2753)
In reply to: C, still? by error27
Parent article: Building the kernel with Clang

Avoiding an assignment inside a condition expression is a good idea also for better human readability.


to post comments

C, still?

Posted Sep 20, 2017 13:10 UTC (Wed) by karkhaz (subscriber, #99844) [Link]

Also prevents
if ((options == (__WCLONE|__WALL)) && (current->uid = 0))
        retval = -EINVAL;
circa 2003: https://freedom-to-tinker.com/2013/10/09/the-linux-backdoor-attempt-of-2003/

C, still?

Posted Sep 21, 2017 3:54 UTC (Thu) by jreiser (subscriber, #11027) [Link]

If there is only one test (no && or ||) and only one group of assignments (a=b=c but no , [sequential comma]) then assignment inside an if can be OK.


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