3 ms·
Once you understand the type declaration syntax via the “declarations mirror use” guideline, there is nothing weird in C syntax. Any scary “pointer to function
by bluetomcat 7y ago
Once you understand the type declaration syntax via the “declarations mirror use” guideline, there is nothing weird in C syntax. Any scary “pointer to function returning pointer to array” declarations are easily disentangled by applying the operators in the correct order around the declared name. People who know that rule tend to put the asterisk next to the name in pointer declarations.
The semantics of the language are quite simple if we discard the weird implicit integer promotion and conversion rules. Every operation yields a new value of a certain type, and some expressions are considered lvalues by virtue of designating a modifiable location in memory.
- kazinator 7y agoRui was struggling with implementing it, not understanding and using it. He found that with 15 years of C experience, he didn't understand it well enough to just sit down and implement all of it without studying the spec.
- bluetomcat 7y agoI didn’t mean to devalue the efforts of the author, just wanted to point out that it is relatively straightforward to write a minimal C compiler, and the gotchas are in some small details.
- deleted 7y ago[deleted]
- Koshkin 7y agoBut the art of this is in getting all these details accounted for in a staightforward manner.