GNU Pascal Homepage - gpc - gpc-announce - gpc-de - gpc-doc
Diese Seite auf deutsch

Mail #6312

Back to main page of archive

Previous mail   Next mail   Unformatted/full headers
Overview  10 days   Subject   Date   Thread   Author  

From: levi@localhost.nc3a.nato.int
Subject: a string question
Date: 11 Jul 2001, 10:58:12

Adam Naumowicz wrote:

> Hello,
> 
> I have a basic question concerning strings and array memory representation
> in GPC. To my amusement I noticed that in the following program the string
> assigned to an array element cannot be then restored from the array
> itself.
> So probably an array of strings is not represented in memory just like an
> array of simple type, and cannot (?) be simply getmem-ed ?
> 
> program test;
> type
>   NameStr=String[8];
>   shortarray=array[1..3] of NameStr;
> 
> var
>   n:NameStr;
>   a:^shortarray;
>   i:integer;
> 
> begin
>  getmem(a,3*sizeof(NameStr));
>  n:='12345678';
>  for i:=1 to 3 do
>   begin
>    a^[i]:=n;
>    writeln('n = ',n)
>    writeln('a^[i] = ',a^[i]);
>   end;
> end.
> 
> As a result the value of a^[i] is an empty string after the assignment;
> I will be very grateful for any answers or comments
> (I use gpc version 20010502, based on 2.95.3 20010315).

Strange. For me it works as expected (djgpp 20010623 based on 2.95.3)
Maurice

Previous mail   Next mail   Unformatted/full headers
Overview  10 days   Subject   Date   Thread   Author  


In reply to

Author Subject Date
Adam Naumowicz a string question 10 Jul 2001, 18:24:35

Back to main page of archive


Note: This page contains information that does not originate from the owner of this web site, but from the authors of the mails archived. The owner of this web site is not responsible for the content of such information. Any use of that infomation requires the consent of the respective author.

Where WWW addresses (URLs) in the mails archived are marked as hyperlinks, this is only for the comfort of the reader. The content of the web pages linked to like this does not necessarily reflect the opinion of the owner of this web site or of the authors of the mails archived. The owner of this web site is not responsible for the content of such web pages. Those pages are explicitly not to be considered as part of the content of this page, but merely as references.


This page was created by Crystal 0.999 (Linux 2.4.27/i686).