try block portability?

Davidl at 126.com Davidl at 126.com
Wed Mar 7 23:17:45 PST 2007


i've seen reactos hacker suffer from PSEH thingie.
and they use a macro to implement PSEH try block.
the PSEH try block would looks like
_PSEH_TRY
{
....
}
_PSEH_EXCEPT
{
...
}
_PSEH_END

this is a good idea since all try block code implemented
in C. and it's more portable than
try
{
}
except
{
}

but it's very difficult to ensure it's correct. and also the
binary generated is dummy and low efficient, cause the idea
of it is implemented roughly as following

for(;;)
{
if not firsttimevisit
{
   ... try  code
   break;
}
else
{
    if (setjmp(label1))
    label1:
    {
       ... finally code
    }
    else
    {
       continue;
    }
}
}

any idea of meta-programming of implementing this try block
stuff? or need some compiler support?

and binding try block binary with compiler is really ain't a
good idea, compiler needs to support linux version, windows
version.



More information about the Digitalmars-d mailing list