On 17 September 2013 09:52, Jakub Jermar <[email protected]> wrote: > On 17.9.2013 1:06, Jiří Zárevúcky wrote: > > Because list_t feels too obscure to me. To me it's much easier to write > > linked list manipulation in-line, and I think the resulting code is > > clearer as well. Note that I did use list_t and list_foreach() until a > > few days back, but after recent addition of two more magical arguments > > to list_foreach() macro, I just didn't have the energy to go figure out > > how it works. > > > > That being said, I would not oppose changing this back to list_t... but > > for this one thing, I am not going to be the one doing the change. > > Why wouldn't you?
Two specific reasons why: 1) It's macro magic. You use as "arguments" arbitrary words you generate code with. Such stuff IMHO should not be done, unless you really have no other alternative. 2) The library types obscure what kind of list it is. You could just as well replace all pointer types in the code base with "void *". You could do better. For example, mandate that a real "next" pointer is used in the list entry, and let the library check its offset and operate on these pointers. You wouldn't need list_t or link_t, you would instead use what they really mean. Instead of using magical macro to retrieve entry from a link, you can have the library function return void pointer to the entry, which in C casts to any pointer implicitly. Easier to use, easier to understand, cleaner interface. -- Jirka Z.
_______________________________________________ HelenOS-devel mailing list [email protected] http://lists.modry.cz/listinfo/helenos-devel
