On Tue, Jul 25, 2017 at 01:19:16PM +0300, Alexander V. Lukyanov wrote:
> On Tue, Jul 25, 2017 at 04:55:54AM -0400, Thomas Dickey wrote:
> > > > e) fix a different fail-to-build with the opaque TERMTYPE
> > >
> > > I don't see how these lines are equivalent:
> > >
> > > -   TERMTYPE *tp = &cur_term->type;
> > > +   TERMTYPE *tp = (TERMTYPE *)(&cur_term);
> >
> > They're the same because the first member of TERMINAL happens to be
> > a TERMTYPE, and since TERMINAL is opaque in current code (so you
> > cannot refer to the "type" member any longer).
> 
> But shouln't it be (TERMTYPE *)(cur_term) ?

hmm - I agree that doesn't look right (the problem with casts).
I'm surprised it worked.
 
> Is there a new function or macro to get current TERMTYPE, so that I could
> use it if available?

Not syntactically the same.  This is what I use in term.h:

/* The cast works because TERMTYPE is the first data in TERMINAL */
#define CUR ((TERMTYPE *)(cur_term))->

-- 
Thomas E. Dickey <dic...@invisible-island.net>
http://invisible-island.net
ftp://invisible-island.net

Attachment: signature.asc
Description: Digital signature

Reply via email to