Message: 6
Date: Sat, 16 Oct 2010 16:34:01 +0200 (CEST)
From:
Subject: Re: [Lazarus] [fpc-devel] win64 dwarf patch To: Lazarus mailing list
Message-ID:
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Michael Van Canneyt wrote 10 lines
> CstomData: packed record
> case integer of
> 0 : (i64: int64);
> 1 : (lo32, hi32 : Cardinal);
> 2 : (Words : Array[0..3] of Word);
> 3 : (Bytes : Array[0..7] of Byte);
> 4 : (p : pointer);
> 5 : (obj : TObject);
> end;
You just invented a Variant type.
Hardly, It's a variant record and has been around since at least Turbo Pascal 3.0 20 years ago! Variant types include logic to prevent you from performing inappropriate operations on typed data. This contains no logic at all.
Indeed, and the whole point is to have a type-safe solution.
It isn't Type-Safe, it's exactly the opposite. It's a way of fooling the compiler into performing Pointer operations on an array of Char for example. Again, this was possible in TP3, it's called TypeCasting. If we want to access CustomData as a 64 bit integer then use int64(CustomData), everyone (should) know what this does. Either that or declare CustomData as "Variant"
It's a shame that you decry the use of Tag as a pointer and then seem to offer your implicit support to nonsense like this!