N
Noob
Hello everyone,
The following code (probably a typo) elicits a warning from GCC.
int main(void)
{
int uu, vv = 0;
uu = uu = vv;
return 0;
}
$ cc -Wall foo.c
foo.c: In function 'main':
foo.c:4: warning: operation on 'uu' may be undefined
I imagine what the author meant to write was
uu = uu & vv; (or some other bit-wise operator)
but instead wrote
uu = uu = vv;
For my information, does the statement
uu = uu = vv;
have undefined behavior?
I would say the behavior is well-defined.
Regards.
The following code (probably a typo) elicits a warning from GCC.
int main(void)
{
int uu, vv = 0;
uu = uu = vv;
return 0;
}
$ cc -Wall foo.c
foo.c: In function 'main':
foo.c:4: warning: operation on 'uu' may be undefined
I imagine what the author meant to write was
uu = uu & vv; (or some other bit-wise operator)
but instead wrote
uu = uu = vv;
For my information, does the statement
uu = uu = vv;
have undefined behavior?
I would say the behavior is well-defined.
Regards.