What is the purpose of the unary '+' operator? In both C and Go they are 
syntactically correct but neither generate instructions to modify the 
expression. 

The '-' operator obviously generates a neg or sub from 0 instruction to negate 
the result by inverting the expression with an add with carry.

I know of no single instruction or pair of instructions to reliably ensure any 
value or expression is always positive so why include this unary operator at 
all? Is there a purpose I'm missing? Or is it just for clarity or force an 
implicit variable to be signed?

As in:

x := +5

Would this ensure that x must be signed during impicit type inference? 

If I read the specification correctly, this would also affect the resolution of 
untyped constants. Is this correct?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to