Re: Dynamic Menu Errors


Subject: Re: Dynamic Menu Errors
From: Mike Nordell (tamlin@algonet.se)
Date: Tue Apr 17 2001 - 16:00:06 CDT


James Montgomerie wrote:
> The use of DELETEP with a cast inside it is causing problems
[...]
> Specifically, lines like:
>
> DELETEP(static_cast<EV_Menu_Action *> (tmp));
>
> are throwing up this compilation error:
>
> ANSI C++ forbids cast to non-reference type used as lvalue.

One could possibly use

static_cast<EV_Menu_Action&*>

but that would just be even more ugly.

> I haven't posted a patch. because I couldn't decide which solution was
> the most 'correct' or understandable.

I still think the most both correct and understandable is:

    delete tmp;
    tmp = 0;

/Mike



This archive was generated by hypermail 2b25 : Tue Apr 17 2001 - 15:58:57 CDT