Thx Ido... U r absolutly correct... But why delphi overcomed this "error"...

This code complied under D6!!



Any way, many thanks..

Best regards,
M. Hammady
 


-----Original Message-----
From: ik [mailto:[EMAIL PROTECTED] 
Sent: Saturday, January 13, 2007 2:46 AM
To: [email protected]
Subject: Re: [lazarus] FPC Incompatible types error

On 1/13/07, Mohamed A. Hammady <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have the following types declaration
>
> type
>   LongIntRA = array [1..1] of LongInt;
>   LongIntp = ^LongIntRA;
> .
> .
> .
>
> Procedure test;
> var
>    lLongRA: LongIntp; Pos: Longint;
> Begin
> .
> .
> .
>   lLongRA[1] := Pos;
> .
> .
> .
> End;
>
> When I complie, I got the following error
> Error: Incompatible types: got "LongInt" expected "LongIntRA"
>
>
> This code was accepted by D6... Any advise? And why?

You are trying to write to a memory address (that was allocated at position 1) 
an integer content instead of pointer address. So you need to do the following:

iLongRA^[1] := Pos;

And then you'll be able to store on cell 1 of the *array* the content of Pos.

>
> Thanks & best regards,
> M. Hammady
>


Ido
--
http://ik.homelinux.org/

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to