From: "Florian Klaempfl" <[EMAIL PROTECTED]>
2. Define new types PSysChar/SysString to correspond either
PChar/AnsiString
or PWideChar/WideString depending from OS type.
It's not a good idea to have String as WideString *without* reference
counting on WinCE, and Wide or Ansi strings *with* r
Marco van de Voort wrote:
var
v : cardinal;
begin
v:=100;
inc(v,-1);
end.
The reason is that -1 is in fact an addition of $ resulting in the
carry flag being set and therefor an overflow.
For cardinal IMHO not-a-bug?
I think it's a bug for cardinals and other unsigned ints also (a
C Western a écrit :
Marco van de Voort wrote:
var
v : cardinal;
begin
v:=100;
inc(v,-1);
end.
The reason is that -1 is in fact an addition of $ resulting
in the
carry flag being set and therefor an overflow.
For cardinal IMHO not-a-bug?
I think it's a bug for cardinals and o
shouldn't it implement inv(v,-1) in exactly the same way it implements
v:=v-1?
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Marcel
> Martin
> Sent: 06 July 2005 23:36
> To: FPC developers' list
> Subject: Re: [fpc-devel] bug: Inc(v,i)/Dec(v,i)
>
>
>
peter green a écrit :
shouldn't it implement inv(v,-1) in exactly the same way it implements
v:=v-1?
Well, I am far to be an expert in compilers but I think no,
it shouldn't.
v := v + Longword(-1) is different from v := v - Longword(1).
The resulting value v is the same but not the way to get i
> shouldn't it implement inv(v,-1) in exactly the same way it implements
> v:=v-1?
The problem is what type do you give to -1. In the old situation the -1
was converted to the same type as v -> longword. Resulting in $.
Adding the $ gives an overflow.
Note that the compiler doesn'