reading John Regehr on undefined behavior

Reading http://blog.regehr.org/archives/213 with a colleague today, I was asked: when is it ever correct to optimize away a check for pointer NULL-ness? Doesn’t this optimization cross a line into outright sabotage?

I didn’t have a good answer, and mumbled that the programmer’s intent might not always be apparent to the optimizer.

Advertisements

Leave a comment

Filed under Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s