3 ms·
I like that you have an example, but I'm not getting the results you are. Perhaps there is some oddity with your odd use of pointers? I switched the code to
by nkurz 11y ago
I like that you have an example, but I'm not getting the results you are. Perhaps there is some oddity with your odd use of pointers?
I switched the code to this:
#include <stdio.h>
int main(int argc, char **argv) {
const int b = 9;
b = 10;
printf("%d",b);
}
And I get a very clear "error" and nothing compiled with gcc, icc, and clang. Did you maybe have a left over binary from a previous compilation? I didn't try OSX, but it's possible the real moral would be to always pay attention to warnings.
- Terribledactyl 11y agoIt's all about the underhanded trick(s) with the pointers, yours will never compile. I'm forcing clang to do horrible things.