Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

  const int div = 0;
  if(div) { 
    return 1/div;
  }
  return 0;
The statement at line 3 would have undefined behaviour, yet is never reached so this is a perfectly legal program and any transformation that hoists it above the check is invalid.

If you replace 'if(div)' with an opaque function call, that doesn't change anything as the function might never exit the program, never return, long jump or return via an exception.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: