Am 15.04.2016 10:46 schrieb "Tony Whyman" <tony.why...@mccallumwhyman.com>: > > Ryan, > > If you want to get rid of (ugly) typecasts then maybe you should investigate the "absolute" keyword. You get a lot of examples in the LCL. For example, here's one I chose at random: > > function TGtk2WidgetSet.RawImage_CreateBitmaps(const ARawImage: TRawImage; out > ABitmap, AMask: HBitmap; ASkipMask: boolean): boolean; > var > GdiObject: PGDIObject absolute ABitmap; > GdiMaskObject: PGDIObject absolute AMask; > Desc: TRawImageDescription absolute ARawImage.Description; > .... > > > You could describe it as typecast done in the var clause of a method. The right hand identifier is not restricted to function parameters.
While it works using "absolute" for a public API is rather unsafe (I'd only use that in private methods). In those cases the "as" operator should he used (or at least "is" plus returning an error). Regards, Sven
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal