> 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.

Nope. The C style cast is not type safe. Using the "as" operator is.

var
  p: pointer;
  i: integer;
begin
  i := 10;
  p := TObject(i); //will work, but is invalid
  p := (i as TObject); //should fail (not tried) because i is not compatible
end;

M

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to