A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2005-November/058140.html below:

[Python-Dev] Memory management in the AST parser & compiler

[Python-Dev] Memory management in the AST parser & compiler [Python-Dev] Memory management in the AST parser & compilerMarek "Baczek" Baczyński imbaczek at gmail.com
Tue Nov 15 13:22:21 CET 2005
2005/11/15, Nick Coghlan <ncoghlan at iinet.net.au>:
> Specifically, the body of the entire function is written inside a switch
> statement, with 'break' then used as the equivalent of "raise Exception". For
> example:
>
>    PyObject* switchAsTry()
>    {
>      switch(0) {
>        default:
>          /* Real function body goes here */
>          return result;
>      }
>      /* Error cleanup code goes here */
>      return NULL;
>    }
>
> It avoids the potential for labelling problems that arises when goto's are
> used for resource cleanup. It's a far cry from real exception handling, but
> it's the best solution I've seen within the limits of C.

<delurk>
do {
    ....
    ....
} while (0);


Same benefit and saves some typing :)

Now back to my usual hiding place.
</delurk>

--
{ Marek Baczyński :: UIN 57114871 :: GG 161671 :: JID imbaczek at jabber.gda.pl  }
{ http://www.vlo.ids.gda.pl/ | imbaczek at poczta fm | http://www.promode.org }
.. .. .. .. ... ... ...... evolve or face extinction ...... ... ... .. .. .. ..
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4