[fpc-pascal] dynamic array and new/dispose
Amit Bueno
amitbueno at gmail.com
Wed Feb 2 14:10:24 CET 2011
Have you got the prof.rar?
Amit
From: fpc-pascal-bounces at lists.freepascal.org [mailto:fpc-pascal-bounces at lists.freepascal.org] On Behalf Of ik
Sent: Wednesday, February 02, 2011 11:29 AM
To: FPC-Pascal users discussions
Subject: Re: [fpc-pascal] dynamic array and new/dispose
On Wed, Feb 2, 2011 at 11:18, Amit Bueno <amitbueno at gmail.com> wrote:
I am compiling in a delphi mode.
Sorry for not posting a runnable source code,.
The code portion was taken from a huge source code, which is probably hard
to detach from the rest of the code.
It is reading a TStream object, which is an input 3ds file given to the app.
Can you write a small proof of concept that does exactly the same thing with the problem ?
---
Amit
-----Original Message-----
From: fpc-pascal-bounces at lists.freepascal.org
[mailto:fpc-pascal-bounces at lists.freepascal.org] On Behalf Of Jonas Maebe
Sent: Wednesday, February 02, 2011 11:17 AM
To: FPC-Pascal users discussions
Subject: Re: [fpc-pascal] dynamic array and new/dispose
On 02 Feb 2011, at 09:20, Amit Bueno wrote:
> // creating and reading more data
> SubChunks[NewSubChunk]^.read(Fl);
>
> // NewSubChunk function
> Function Chunk.NewSubchunk: integer;
> begin
> setlength(SubChunks, High(SubChunks)+2);
> New(subchunks[High(SubChunks)], create);
> SubChunks[High(SubChunks)]^.Data := Self.Data;
> Result := High(SubChunks);
> end;
>
> // ---------
> The procedure fails when running the:
> SubChunks[NewSubChunk]^.read(Fl);
>
> All the procedure works fine on Delphi, but on fpc under iMac it
> fails.
> Why?
>
Are you compiling in Delphi mode? Please *always* post compilable
source code that demonstrates the problem when asking for help, not
uncompilable snippets. Don't make people guess about what you might
have written or about how you are compiling it.
Jonas
_______________________________________________
fpc-pascal maillist - fpc-pascal at lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist - fpc-pascal at lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Ido
LINESIP - Opening the source for communication
http://www.linesip.com <http://www.linesip.com/>
http://www.linesip.co.il <http://www.linesip.co.il/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20110202/550938a7/attachment.html>
More information about the fpc-pascal
mailing list