Dynamic Menu Errors

Subject: Dynamic Menu Errors
From: James Montgomerie (jamie@montgomerie.net)
Date: Tue Apr 17 2001 - 12:46:57 CDT

The use of DELETEP with a cast inside it is causing problems in the
compilation of ev_Menu_Actions.cpp, line 138 ev_Menu_Labels.cpp, line
97 and ev_MenuLayouts.cpp, line 96.

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.

I beleive it's bacause DELETEP is expanding these lines to something

delete (static_cast<EV_Menu_Action *> (tmp));
static_cast<EV_Menu_Action *> (tmp) = 0; // This is not legal C++.

The solution is to change these lines to either:

EV_Menu_Action tmp2 = static_cast<EV_Menu_Action *> (tmp);
// We need tmp2 becausing passing a cast into DELETEP causes invalid C+
+ code
// to be generated.

or simply:
DELETEP(tmp); // I think this is legal and non-leaky.

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


This archive was generated by hypermail 2b25 : Tue Apr 17 2001 - 13:43:37 CDT