Re: EWidgetMessageTypes

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Mon Jun 28 1999 - 18:57:56 MEST


Hi Sean,

   you're right. I've added kC_MSGMAX = 10000, so you should be save in
the region 1001-65000.


Cheers, Fons.



Sean Kelly wrote:
> 
> Hi Fons,
> 
> thanks for the response.  I'm guess I'm still worried about casting an
> integer outside the range of an Enum, i.e. if the max val in an enum is 8
> then the range of values you can cast an int to is 0:15.  According to
> Stroustrup's book casting and int outside this range is undefined.  If you
> set kC_MSGMAX = 1024 then the compiler would be forced to allocate more
> bits to the enum and users could safely use messages in the range
> [1000,2046]
> 
> cheers
> 
> Sean
> 
> _____________________________________________
> 
> Sean Kelly
> Dept. of Physics
> University of California Los Angeles
> office tel. (310)-825-6035
> fax (310)-206-4397
> voice mail (310)-259-3747
> _____________________________________________
> 
> On Sun, 27 Jun 1999, Fons Rademakers wrote:
> 
> > Hi Sean,
> >
> >    the EWidgetMessageTypes enum is just to provide nice nmemonics for the
> > message types. The kC_MSGMAX id was not used and I've removed it from
> > the enum. Casting to the EWidgetMessageTypes enum is ok. However to prevent
> > any clash with future system widgets I propose that user defined message
> > types are >1000. For sub-messages the range is always 1-255.
> >
> > I've added this user message type requirement (>1000) to the documentation
> > (in the new header WidgetMessageTypes.h).
> >
> >
> > Cheers, Fons.
> >
> >
> > >
> > > Hi Rooters
> > >
> > > To take advantage of MK_MSG I used statements such as,
> > >
> > > #define   M_NEW_1DHISTO      ((EWidgetMessageTypes) 9)
> > >
> > > Casting an integer outside the range of the enumeration worked (at least
> > > on my platform) but I gather this is not the way to go.
> > >
> > > The comment in the source (TGWidget.h)
> > >
> > > //--- Widget messages and submessages
> > > //    (sub messages must be in the range 1-255)
> > > //    (these should be on a separate include file)
> > >
> > > seems to indicate that sub-messages can be valued up to 255 but
> > > the enumeration has a max val of 8 ?
> > >
> > > thanks for any help
> > >
> > >     Sean
> > > _____________________________________________
> > >
> > > Sean Kelly
> > > Dept. of Physics
> > > University of California Los Angeles
> > > office tel. (310)-825-6035
> > > fax (310)-206-4397
> > > voice mail (310)-259-3747
> > > _____________________________________________
> > >
> > >
> >
> >
> > --
> > Org:    CERN, European Laboratory for Particle Physics.
> > Mail:   1211 Geneve 23, Switzerland
> > E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
> > WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910
> >

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:35 MET