objective c - Why doesn't the Xcode compiler auto-error for pointer type safety? -


for example:

void modlongeraddress(double *aptr) {     *aptr = 1.11;      // or number goes beyond storage capacity of single precision float }  int main(int argc, const char * argv[]) {     float singleprecision = 1.11;     modlongeraddress(&singleprecision);      return 0; } 

as far can tell, generates warning. wouldn't situation considered dangerous enough generate hard error, or missing something?

thanks whozcraig's help, found setting causing this. appears in xcode 6.2 (6c101), there setting called "treat incompatible pointer type warnings errors" set "no" default.

this setting found in build settings of project, under "apple llvm 6.0 - warnings - languages".

simply toggling "yes" did trick, , build failed expected.

edit: big bonus suppose if explain why would set "no" default? appears may not true versions of xcode?


Popular posts from this blog