User: Password:
Subscribe / Log in / New account

Request clue-bat

Request clue-bat

Posted Jun 29, 2006 11:58 UTC (Thu) by smitty_one_each (subscriber, #28989)
Parent article: Trees II: red-black trees

>struct rb_node **link = &root->rb_node, *parent;

What is the effect of the comma? At first blush, we appear to be trying to assign two values to **link.

(Log in to post comments)

Request clue-bat

Posted Jun 29, 2006 17:16 UTC (Thu) by ncm (subscriber, #165) [Link]

No, it's just defining two variables, and leaving one uninitialized. In C++ code this would be bad form, but in C89 you have to define variables at the top of the block, often before you're ready to initialize them to anything useful. The kernel isn't coded in C89, though; it requires Gcc. With recent releases of Gcc, if run with C99 support turned on, variables can be defined in the middle of a block. It's really only inertia supporting this unfortunate practice.

Request clue-bat

Posted Apr 11, 2007 19:33 UTC (Wed) by jengelh (subscriber, #33263) [Link]

Bad form or not, it is also allowed in C++.

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