Trailing catch on function?
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Mon Nov 7 15:37:18 PST 2016
On 11/6/2016 8:30 PM, Manu via Digitalmars-d wrote:
> Hey people, I'm passing lots of D function pointers to C, and naturally, the C
> api expects the fp signatures are all nothrow.
>
> Which means, my D functions all look like this:
>
> void callback() nothrow
> {
> try
> {
> ...lots of code...
> }
> catch (Exception e)
> {
> ...log error or abort...
> }
> }
>
>
> I'm generally annoyed by all the extra indentation.
void callback() nothrow
{
scope (failure)
{
...log error or abort...
}
...lots of code...
}
More information about the Digitalmars-d
mailing list