Page 3 of 3
Posted: June 18th, 2010, 20:50
by deject
Huh. That may be the compiler you're using or something because I'm pretty sure that it wasn't like that to begin with.
Posted: June 18th, 2010, 20:50
by Baliame
It's not the compiler, check the link.
In fact, surprisingly the Microsoft Visual compiler is currently one of most convention-compliant compilers today.
Lawyered.

Posted: June 18th, 2010, 20:56
by buzzmong
Bubbles is correct.
C++ reads left to right for operations of the same precedence.
Posted: June 18th, 2010, 21:02
by Baliame
buzzmong wrote:C++ reads left to right for operations of the same precedence.
While correct, it's entirely not what we were debating!

Posted: June 18th, 2010, 21:25
by buzzmong
Essentially, yes it is.
It would be best to show it in a parse tree so you can clearly see what's happening, but I cannot be fucked to draw one and have no intention of ever doing one again narf.
Posted: June 18th, 2010, 21:42
by HereComesPete
Okay, you all need to stop C++ock waving and make a main stream 5punk game that infects the minds of millions damn it!
Posted: June 18th, 2010, 21:55
by Baliame
As a matter of fact it is a 2D engine I'm working on, it could be magically transform into a game if you can come up with something absolutely mind-blowing.
Buzz: I know it does this weird thing which has a name which absolutely escapes me, like for the problem above: 1 3 4 * - 7 +.
Posted: June 18th, 2010, 21:57
by buzzmong
How about a game of blowing minds? With air horns. Or vuvuulvuuzuzubzbbbzzzzzzzzzzzzbzzzzzzzzzzz thiniges.
Posted: June 18th, 2010, 22:08
by Stoat
buzzmong wrote:How about a game of blowing minds? With air horns. Or vuvuulvuuzuzubzbbbzzzzzzzzzzzzbzzzzzzzzzzz thiniges.
[media]
http://www.youtube.com/watch?v=7B2LPxggvqY[/media]
Posted: June 18th, 2010, 22:26
by Mr. Johnson
You guys seen the new
frontpage right?
Posted: June 18th, 2010, 22:37
by buzzmong
Hahaha, that was brilliant!
Posted: June 18th, 2010, 22:43
by HereComesPete
Mr. Johnson wrote:You guys seen the new
frontpage right?
THE BEES!
NOT THE BEES!
OH GOD THE BEES!
THEY'RE WEARING A BEAR SUIT!
Posted: June 18th, 2010, 22:48
by FatherJack
C++ does indeed give -4

It's documented as having + above - in its operator preferences, but actually treats them equally - perhaps, as deject mentioned, because they are essentially the same operation.
In terms of what I was taught, it was to
never write equations ambiguously, or at least I learned that at some point. While I did maths into college level, it's later that I did programming, so I guess it's that methodology that has stuck with me.
Posted: June 18th, 2010, 23:39
by cheeseandham
-4
and I'm right, so end of discussion

Posted: June 18th, 2010, 23:41
by Baliame
Just to clear it up once and for all, C++ has 16 tiers for operators
1. Scope
2. Brackets and casts
3. Unary operations (negation, increment, logical NOT, pointer denomination, etc.)
4. Pointer resolution
5. Multiplication, division, modulo
6. Addition, subtraction
7. Shift
8. Less/greater than
9. Equal and not equal
10-11-12. Bitwise AND / Bitwise XOR / Bitwise OR
13-14. Logical AND / Logical OR
15. Conditional operator
16. Assignment (=, +=, *=...)
TL;DR Deej should consider using a proper compiler.
Posted: June 19th, 2010, 10:27
by shot2bits
you cupcake!
this made me splutter tea over my new keyboard
Posted: June 19th, 2010, 17:32
by deject
You know what, I'm probably being a dumb spanner because I remember now that C++ will look at the entire expression first. It's Java that will do it wrong.
Posted: June 19th, 2010, 19:51
by Anhamgrimmar
Yes well, this is all to the good, but WHERE DID THE OTHER POUND GO?
Posted: June 19th, 2010, 22:02
by Baliame
deject wrote:It's Java that will do it wrong.
I wouldn't be surprised, Java is evil.
Posted: June 20th, 2010, 1:15
by FatherJack
Heh, I liked them poking through the door, but if only they were so tuneful.