Tuesday, January 13, 2015 [Tweets] [Favorites]

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

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment