I stand corrected. I've just checked Delphi5 and indeed it allows a
direct typecast from ansistring to any object/class :-/
But Delphi also allows direct cast from enumeration value to pointer
(which FPC doesn't allow), so maybe this is another nice oportunity to
be stricter than Delphi ;-)
Cheer
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
> 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
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 AnsiSt
On 5/14/06, Matt Emson <[EMAIL PROTECTED]> 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 m
> 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
M
Weird, I wouldn't expect OBJFPC mode to allow automatic conversion
from AnsiString to Pointer...
-Flávio
On 5/12/06, Vinzent Hoefler <[EMAIL PROTECTED]> wrote:
Just found a bug of mine I was wondering about since about three days,
and wanted to share the fun with you:
-- 8< --
// "How to rais
> raise Not_Now (Exception_Message);
I feel your pain!
far too much like :
throw Not_Now(Exception_Message);
My brain does this all the time moving between C# and Delphi. The one I
always seem to do, is "except" instead of "catch" in "try" blocks. At
least the compiler/syntax checker get
Just found a bug of mine I was wondering about since about three days,
and wanted to share the fun with you:
-- 8< --
// "How to raise the wrong exception" or
// "Why automatic type conversion really sucks"
{$MODE OBJFPC}
program
Exception_Fun;
uses
SysUtils;
function Exception_Messa