On Tuesday, 26 December 2017 at 07:01:16 UTC, codephantom wrote:
On Tuesday, 26 December 2017 at 04:47:35 UTC, Walter Bright
wrote:
Only if someone considers this as fixed:
int foo(int* p) { return p[1]; }
int bar(int i) { return foo(&i); }
clang++ -c test.cpp -Wall
good example..and it makes a good point.
however, let that point be not that C/C++ is flawed (since
pointers are meant to let you point to anywhere), but rather
that the code example is flawed.
there is a difference between a flawed language, and flawed use
of that language.
e.g. what if I accidently left out the @safe attribute on those
functions in D?
Then whoever is using your code (you?) will find that out when
they call your functions from a @safe function.