Groups
Groups
Sign in
Groups
Groups
golang-nuts
Conversations
About
Send feedback
Help
Go Operator Precedence
2,197 views
Skip to first unread message
ianeperson
unread,
May 6, 2012, 6:34:10 PM
5/6/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
The operator precedence in Go is not only shorter than that for C (C+
+, and their various derivatives), it has significant differences:
For example: 3 * 2 << 3 * 2
In Go gives: 96
In C gives: 384
Some care is going to be required when moving code blocks in Go.
DisposaBoy
unread,
May 7, 2012, 12:54:22 AM
5/7/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golan...@googlegroups.com
The info you're after is in the spec
http://golang.org/ref/spec#Operator_precedence
But I'd say just use parentheses, *no-one* is going to understand what the real intent of that code is
tungche...@gmail.com
unread,
Oct 23, 2016, 1:37:05 AM
10/23/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts, ian.e...@dedf.co.uk
I would recommend you use bracket no matter on which language,
then people from different language can understand it without risk
Reply all
Reply to author
Forward
0 new messages