3 ms·
I'm curious where this fits in with single assignment semantics: int x = 3; x = 4; // error! int* p = &x; *p = 4; // is that an error?
by WalterBright 1y ago
I'm curious where this fits in with single assignment semantics:
int x = 3;
x = 4; // error!
int* p = &x;
*p = 4; // is that an error?
- taf2 1y agoAt least with clang it's a warning: f.c:4:8: warning: initializing 'int *' with an expression of type 'const int *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] 4 | int* p = &x; | ^ ~~ 1 warning generated.
- wicharek 1y agoYes, because line 3 would implicitly be: const int * p