[fpc-pascal] working witg UCS4Char
ik
idokan at gmail.com
Fri Nov 9 23:28:43 CET 2012
On Fri, Nov 9, 2012 at 6:56 PM, Tomas Hajny <XHajT03 at hajny.biz> wrote:
> On Fri, November 9, 2012 17:38, ik wrote:
>> On Fri, Nov 9, 2012 at 6:12 PM, Tomas Hajny <XHajT03 at hajny.biz> wrote:
>>> On Fri, November 9, 2012 17:01, ik wrote:
>>>> On Fri, Nov 9, 2012 at 5:16 PM, Jonas Maebe <jonas.maebe at elis.ugent.be>
>>>> wrote:
>>>>> On 09 Nov 2012, at 16:06, ik wrote:
>>>>>
>>>>> And if I do it without the hash, then it's just a number
>>>>>
>>>>>
>>>>> UCS4Char is in fact just a number, and UCS4String is just a dynamic
>>>>> array of
>>>>> cardinal. UCS4 is not implemented as a complete string type in FPC (or
>>>>> Delphi, for that matter).
>>>>
>>>> Cardinal is a bit problematic type, you mean longword. :)
>>>
>>> Why do you see cardinal as a "problematic type"? At least for FPC it is
>>> a
>>> simple alias to longword (and it has actually existed even before
>>> longword
>>> in FPC).
>>
>> At least with Delphi it has unclear what exactly the size of it.
>> And the following code:
>> https://github.com/ik5/fp-msgpack/blob/master/src/msgpack.pas#L528
>>
>> Used to be with Cardinal (the only difference), and It never acted as
>> expected.
>> The only thing I changed was from cardinal to longword, and it acts as
>> expected.
>
> With Delphi or with FPC? As already mentioned, FPC defines cardinal as an
> alias to longword (and UInt32 mentioned in your reference as an alias to
> cardinal) so there should be no difference between cardinal, longword and
> UInt32 (and in the past, cardinal was even the primary type in FPC
> directly known by the compiler).
>
> With Delphi, I believe that very old Delphi versions defined cardinal as a
> 31-bit type (i.e. simply the non-negative part of the longint range), but
> I also believe (while not using Delphi at all myself) that all currently
> relevant Delphi versions (i.e. not considering things like Delphi 1.0 and
> Delphi 2.0 which probably didn't support longword anyway) define cardinal
> as equal to longword.
With FPC. The value was saved wrong.
The only thing that I changed in my code was moving from Cardinal to LongWord.
I do not own Delphi or Windows copy for many years now :)
>
> Tomas
>
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
More information about the fpc-pascal
mailing list