[fpc-pascal] Typecasting by accident

Flávio Etrusco flavio.etrusco at gmail.com
Sat May 20 08:52:28 CEST 2006


I stand corrected. I've checked Delphi5 today and none of my
expectations where correct :-(
Of course I think that AnsiString being a native type would require
that (one) typecast just like any other (native type).

Of course I also think that any object should be cast to a mininum
common ancestor before being cast to any other class, but maybe it's
just me ;-)

-Flávio


On 5/15/06, Jonas Maebe <jonas.maebe at elis.ugent.be> wrote:
>
> On 15 mei 2006, at 18:09, Flávio Etrusco wrote:
>
> >> It's a CAST dude! Exception_Message is being case as Not_Now. That
> >> should
> >> work fairly well in most dialects.t
> >
> > No. Typecasts, as any other aspect of a language, has to have rules.
> > AFAIR this cast in Delphi would require another cast from AnsiString
> > to Pointer.
>
> It doesn't.
>
> > And if typed pointers is enabled would require another
> > cast from Pointer to TObject.
>
> No. {$t+} only influences implicit pointer conversions.
>
>
> Jonas
>



More information about the fpc-pascal mailing list