I was looking at the following code:
#include <stdint.h>
void foo(uint32_t *pVal)
{
uint32_t i = 8;
*pVal = i *= 10;
}
At the first glance it is clear that before returning from foo(), *pVal would be 80 as well as the value of i. And this is indeed what happens according to godbolt.org:
foo: # @foo
push rbp
mov rbp, rsp
mov qword ptr [rbp - 8], rdi
mov dword ptr [rbp - 12], 8
imul eax, dword ptr [rbp - 12], 10
mov dword ptr [rbp - 12], eax
mov rdi, qword ptr [rbp - 8]
mov dword ptr [rdi], eax
pop rbp
ret
However after checking the operator precedence from here, the precedence of = is higher than the precedence of *=, so it seems that the value of *pVal should be 8 and the value of i should be 80...
What am I missing here?
EDIT:
In addition to the great answer by melpomene, there is also a nice Wikipedia page.