Best description of how to read C declarations I've seen in a long time.
45 plus ones
Shared publicly•View activity
View 12 previous comments
- C type declarations are ugly and the best way to make them readable and maintainable is to use typedefs.Aug 28, 2011
- Heh, no, typedefs don't help anything, there's a reason we don't use them in the Linux kernel whenever possible.Aug 28, 2011
- these are valid points. Getting used to a unknown codebase is not a simple thing.
But still I think these fancy reading methods are way too unnatural, thats not how most people think when writing/reading code left to right. To be true I just can't imagine that one really tries to understand a declaration in a way that differs so much from the rest of the workflow. :-) It might be more helpful to understand how pointers to pointers work and get used to the common patterns.Aug 28, 2011
- you can also use the command (under Debian):
$ apt-cache search cdecl
cdecl - Turn English phrases to C or C++ declarationsAug 29, 2011
- lwn.net on their weekly kernel pages.For some common design patterns, like this, in the Linux kernel, see the recent series of articles from Neil Brown atAug 29, 2011
- Ouh haven't been there since a while. Holy crap that's alot of interesting stuff. Thanks!Aug 29, 2011