[fpc-pascal] Typecasting by accident

Flávio Etrusco flavio.etrusco at gmail.com
Mon May 15 18:09:19 CEST 2006

On 5/14/06, Matt Emson <memsom at interalpha.co.uk> wrote:
> > Weird, I wouldn't expect OBJFPC mode to allow automatic conversion
> > from AnsiString to Pointer...
> Um...
> >       raise Not_Now (Exception_Message);
> 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. And if typed pointers is enabled would require another
cast from Pointer to TObject.
OBJFPC is usually regarded as more strict than DELPHI mode, so I
wouldn't expect this lax cast to be allowed.


More information about the fpc-pascal mailing list