Not logged in
Log in now
Create an account
Subscribe to LWN
LWN.net Weekly Edition for May 23, 2013
An "enum" for Python 3
An unexpected perf feature
LWN.net Weekly Edition for May 16, 2013
A look at the PyPy 2.0 release
Maybe the case for prefix operators is much more simple:
*a=b; /* ok */
a*=b; /* what should we do with this? */
Posted Jan 29, 2010 18:25 UTC (Fri) by tjc (subscriber, #137)
The issue isn't that postfix indirection is better than prefix; the real issue is that postfix declaration is better than prefix because then the pointer declarator is on the same precedence level as () and , and complex declaration are less... complex. This is problematic in a language like C where declaration mimics use, since the best syntax for declaration is not the same as the best syntax for use.
Posted Jan 30, 2010 10:52 UTC (Sat) by ncm (subscriber, #165)
Posted Feb 4, 2010 18:25 UTC (Thu) by tjc (subscriber, #137)
I better like the idea of separating declaration syntax from expression syntax and using '*' as a postfix pointer declarator and '' as an infix indirection operator, like this:
var p *int;
var a *int;
[p] = 1;
[a] = 1;
I guess I could call this "square lisp" syntax. :)
 This really isn't infix, since the operand is infix, not the operator, but I don't know the correct term for this form.
Posted Feb 4, 2010 22:51 UTC (Thu) by anselm (subscriber, #2796)
 This really isn't infix, since the operand is infix, not the operator,
but I don't know the correct term for this form.
Posted Feb 7, 2010 1:44 UTC (Sun) by tjc (subscriber, #137)
It seems obvious in retrospect. Thanks.
Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds