| Main |

C Operator Precedence

Far too many people don't know how the operator precedence works for C, Objective C or C++, which means they write code that would scare even a Lisp programmer (i.e., far, far too many parentheses [that's brackets, for those that don't know]). This isn't helped by the fact that it's hard to find a precedence table; even the specification doesn't contain one (the precedence information is encoded in the grammar rules in the spec.).

Anyway, here's a precedence table that I've written based on the C99 spec.

Trackbacks

TrackBack URL for this entry:
http://alastairs-place.net/movabletype/mt-tb.cgi/9.

Comments

Post a comment

If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thank-you for your patience.

(Your e-mail address will not be displayed or included in any pages served on this site; nor will you get any spam as a result.)

A live preview of your comment will be displayed below. It should refresh automatically when you stop typing, but if not then the “Preview” button above will update it.

Live Comment Preview