Link Details

Link 966477 thumbnail
User 225256 avatar

By mswatcher
Submitted: May 09 2013 / 06:28

Does ‘return’ always cause a function to return? Surprisingly the answer is “no”. Indeed there are situations in which ‘break’ may not always break from a loop, and ‘goto’ may no go anywhere. I discovered this corner of C++ while writing my own compiler for Leaf. Before you brand it a C++ problem, I had no difficulty recreating the same scenario in Java and Python (see bottom of this blog entry for analogous examples). It’s likely that any language with destructors, finally, or defer clauses is affected.
  • 4
  • 0
  • 95
  • 73

Add your comment

Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Upvoters (4)

Downvoters (0)

    Apache Hadoop
    Written by: Piotr Krewski
    Featured Refcardz: Top Refcardz:
    1. Play
    2. Akka
    3. Design Patterns
    4. OO JS
    5. Cont. Delivery
    1. Play
    2. Java Performance
    3. Akka
    4. REST
    5. Java