The Clockwise/Spiral Rule of C declarations
61–70 of 72 posts
Re: The Clockwise/Spiral Rule of C declarations
#62Re: The Clockwise/Spiral Rule of C declarations
#63Re: The Clockwise/Spiral Rule of C declarations
#64Re: The Clockwise/Spiral Rule of C declarations
#65(PS. Golang has the right idea, since its developed by the guys who contributed to C)...
Re: The Clockwise/Spiral Rule of C declarations
#66Or, as the book Expert C Programming says, declarations in C are read boustrophedonically.
Re: The Clockwise/Spiral Rule of C declarations
#67I read a paper somewhere from dennis ritchie, where he explained the development of C language, the pros and cons; and in there he mentioned that reading complex declarations is a problem in C, he said that if we had placed the * operator to the left of the type it was qualifying then it would have been easier to write and understand more complex declarations. (PS. Golang has the right idea, since its developed by th…
Re: The Clockwise/Spiral Rule of C declarations
#68It's been 20years(!) Why is this incorrect advise still up at c-faq?
Re: The Clockwise/Spiral Rule of C declarations
#69Way simpler: from inside out, read any subpart of the type as an expression. (Arrays have precedence over pointers, as usual.) The type that remains is that expression's type. So e.g. given the type: const char *foo[][50] the following expressions have the following types: foo -> const char *[][50] foo[0] -> const char * [50] foo[0][0] -> const char * *foo[0][0] -> const char Another example: int (*const bar)[restric…
Re: The Clockwise/Spiral Rule of C declarations
#70I read a paper somewhere from dennis ritchie, where he explained the development of C language, the pros and cons; and in there he mentioned that reading complex declarations is a problem in C, he said that if we had placed the * operator to the left of the type it was qualifying then it would have been easier to write and understand more complex declarations. (PS. Golang has the right idea, since its developed by th…
Go fixes a lot of C language design bugs, and the only cost you pay is (sometimes important) garbage collection and extreme memory layout control.