Skip to content

C Right-Left Rule

cseweb.ucsd.edu
6 pointsallending2 comments
On HN

Comments

One of the best quality of life fixes D has over C (and by extensions C++) is getting rid of this complexity. In D you can simply go right-to-left. So instead of having

    char *str[10];
you'd have
    char*[10] str;
which when read right-to-left trivially results in "str is a array 10 of pointer to char"

More readable version with ascok art, as the spiral rule:

http://c-faq.com/decl/spiral.anderson.html

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.