Tuesday, January 13, 2015

Undefined Behavior in C

Mike Ash (via Daniel Jalkut):

It’s possible to invoke undefined behavior in your function. Undefined behavior can mean something never terminates. Thus, it’s possible for your function to never terminate.

If you don’t believe me, I pose the following challenge: give me an implementation of this function. I will then provide a chunk of code that calls it and causes it to enter an infinite loop.

Comments RSS · Twitter

Leave a Comment