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

Mail #13473

Back to main page of archive

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

From: Angelo.Fumagalli@alcatel.it
Subject: Sizeof variant records
Date: 27 Mar 2006, 11:40:29

How can I have the true "sizeof" of  variant records? Gpc sizeof accepts 
only one parameter as type or variable so isn't possible to specify tags 
parameters for example:

type
  myrec_t = packed record
                     a: integer;
                     case b: boolean of
                     true: (x: integer;
                              y: integer);
                     false: (case cc: char of
                               'a': (tst: integer;
                               'b': (t1: byte;
                                      t2: byte);
                               'c': (tx: real));
                    end;
...
writeln(sizeof(myrec_t,true);
writeln(sizeof(myrec_t,false,'a');

I tried to use the new statement instead, e.g.

  var
     p: ^myrec_t;

  begin
      new(p,true);
      writeln(sizeof(p^));
      dispose(p,true);
      new(p,false,'a');
      writeln(sizeof(p^));

but in both cases sizeof return the same value that is the maximum record 
size.

Thanks in advance.

    Angelo Fumagalli




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


Replies

Author Subject Date
Frank Heckenbach Sizeof variant records 27 Mar 2006, 12:17:01

In reply to

Author Subject Date
Waldek Hebisch gcc-3.4.6 15 Mar 2006, 11:45:27

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).