Re: asXInset

2002-11-01 Thread Lars Gullik Bjønnes
Martin Vermeer <[EMAIL PROTECTED]> writes: | On Wed, Oct 30, 2002 at 04:24:30PM +0100, Lars Gullik Bjønnes wrote: >> >> So people... are you ready for a small RTTI survy? >> >> compile this prog and run it: > | [[EMAIL PROTECTED]:~]$ rpm -q gcc | gcc-2.95.2-7cl > > | [[EMAIL PROTECTED]:~]$ g++ x

Re: asXInset

2002-11-01 Thread Martin Vermeer
On Wed, Oct 30, 2002 at 04:24:30PM +0100, Lars Gullik Bjønnes wrote: > > So people... are you ready for a small RTTI survy? > > compile this prog and run it: [[EMAIL PROTECTED]:~]$ rpm -q gcc gcc-2.95.2-7cl [[EMAIL PROTECTED]:~]$ g++ x.C [[EMAIL PROTECTED]:~]$ ./a.out (nil) 0x8049f80 (nil) 0

Re: asXInset

2002-10-31 Thread Jean-Marc Lasgouttes
> "Lars" == Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes: Lars> So people... are you ready for a small RTTI survy? Lars> compile this prog and run it: cxx 6.2 says: fantomas: cxx -std strict_ansi testrtti.C -o testrtti fantomas: ./testrtti 0 14001b480 0 14001b480 So I think it works. J

Re: asXInset

2002-10-30 Thread Lars Gullik Bjønnes
John Levon <[EMAIL PROTECTED]> writes: | On Wed, Oct 30, 2002 at 04:24:30PM +0100, Lars Gullik Bjønnes wrote: > >> later we can even use exceptions: (Bø! Skvatt du nå?) > | If you want to use exceptions we may as well return AInset & then. we might. >> try { >> AInset * a =

Re: asXInset

2002-10-30 Thread John Levon
On Wed, Oct 30, 2002 at 04:24:30PM +0100, Lars Gullik Bjønnes wrote: > later we can even use exceptions: (Bø! Skvatt du nå?) If you want to use exceptions we may as well return AInset & then. > try { > AInset * a = inset->asType(); > a->someAFunction(); > }

Re: asXInset

2002-10-30 Thread Lars Gullik Bjønnes
John Levon <[EMAIL PROTECTED]> writes: | On Wed, Oct 30, 2002 at 04:00:51PM +0100, Lars Gullik Bjønnes wrote: > >> and I didn't really understand the complete Andre method. Care to give >> me a recap? > | class Base { > | virtual AInset * asAInset() { return 0 } | virtual BInset * asB

Re: asXInset

2002-10-30 Thread John Levon
On Wed, Oct 30, 2002 at 04:00:51PM +0100, Lars Gullik Bjønnes wrote: > and I didn't really understand the complete Andre method. Care to give > me a recap? class Base { virtual AInset * asAInset() { return 0 } virtual BInset * asBInset() { return 0 } virtual CInset * as

Re: asXInset

2002-10-30 Thread Lars Gullik Bjønnes
John Levon <[EMAIL PROTECTED]> writes: | On Wed, Oct 30, 2002 at 03:51:22PM +0100, Lars Gullik Bjønnes wrote: > >> AInset * a2 = i->asType(); >> BInset * b2 = i->asType(); >> >> _but_ I guess a lot of complier have problems with RTTI... > | Right, but if we move to Andre's method in the

Re: asXInset

2002-10-30 Thread John Levon
On Wed, Oct 30, 2002 at 03:51:22PM +0100, Lars Gullik Bjønnes wrote: > AInset * a2 = i->asType(); > BInset * b2 = i->asType(); > > _but_ I guess a lot of complier have problems with RTTI... Right, but if we move to Andre's method in the meantime, the upgrade to use proper dyn cast wi

Re: asXInset

2002-10-30 Thread Lars Gullik Bjønnes
Andre Poenitz <[EMAIL PROTECTED]> writes: >> John Levon <[EMAIL PROTECTED]> writes: >> >> | I much prefer Andre's way. Compare >> | >> |InsetSomething * i = inset->asSomethingInset(); >> |if (!i) >> |break; >> | >> | with >> | >> |if (inset->lyxCode() == SOMETHING_CODE) { >

Re: asXInset

2002-10-30 Thread Andre Poenitz
> John Levon <[EMAIL PROTECTED]> writes: > > | I much prefer Andre's way. Compare > | > | InsetSomething * i = inset->asSomethingInset(); > | if (!i) > | break; > | > | with > | > | if (inset->lyxCode() == SOMETHING_CODE) { > | InsetSomething * i = static_cast(i)

Re: asXInset

2002-10-30 Thread Lars Gullik Bjønnes
John Levon <[EMAIL PROTECTED]> writes: | I much prefer Andre's way. Compare | | InsetSomething * i = inset->asSomethingInset(); | if (!i) | break; | | with | | if (inset->lyxCode() == SOMETHING_CODE) { | InsetSomething * i = static_cast(i); |

Re: asXInset

2002-10-30 Thread Lars Gullik Bjønnes
John Levon <[EMAIL PROTECTED]> writes: | I much prefer Andre's way. Compare | | InsetSomething * i = inset->asSomethingInset(); | if (!i) | break; | | with | | if (inset->lyxCode() == SOMETHING_CODE) { | InsetSomething * i = static_cast(i); |

asXInset

2002-10-29 Thread John Levon
I much prefer Andre's way. Compare InsetSomething * i = inset->asSomethingInset(); if (!i) break; with if (inset->lyxCode() == SOMETHING_CODE) { InsetSomething * i = static_cast(i); ... } Does anyone have a problem