Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #32847

Re: Write once C and forth structs

From Bernd Paysan <bernd.paysan@gmx.de>
Newsgroups comp.lang.forth
Subject Re: Write once C and forth structs
Date 2014-08-04 22:35 +0200
Organization 1&1 Internet AG
Message-ID <lroqq2$cka$1@online.de> (permalink)
References (1 earlier) <lrij4s$5jc$1@online.de> <9358212d-746d-4331-b5e5-ded39e632cd7@googlegroups.com> <95f6c055-6369-456d-9356-e5d44c62e47f@googlegroups.com> <op.xj16l3cy6zenlw@localhost> <obydnThvHNyiKkLOnZ2dnUU7-YWdnZ2d@supernews.com>

Show all headers | View raw


Andrew Haley wrote:

> Rod Pemberton <dont_use_email@xnothavet.cqm> wrote:
>> On Mon, 04 Aug 2014 00:03:22 -0400, <hughaguilar96@yahoo.com> wrote:
>> 
>>> The big problem here, is that C structs are limited
>>> to always starting at 0.
>> 
>> What? ...
>> 
>> In fact, I have absolutely no idea what you're even
>> attempting to say here.  Please explain what you
>> mean by:
>> 
>>   "C structs are limited to always starting at 0".
> 
> He's talking about type extension.  Like this in C++:
> 
> typedef struct {
>   int one;
> } a;
> 
> typedef struct : a {
>   int two;
> } b;
> 
> Here, struct b extends a.

Yes, this sort of stuff is pretty useful, so useful that I added it to the 
Forth200x structure implementation in Gforth:

: extend-structure ( n "name" -- struct-sys n ) \ Gforth
    \g extend an existing structure
    standard:field >r 0 value lastxt >body r> ;

And if you want to start a structure that extends nothing? Of course:

: begin-structure ( "name" -- struct-sys 0 ) \ X:structures
    0 extend-structure ;

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Write once C and forth structs Hannu Vuolasaho <vuokkosetae@gmail.com> - 2014-08-02 13:25 +0300
  Re: Write once C and forth structs Bernd Paysan <bernd.paysan@gmx.de> - 2014-08-02 13:47 +0200
    Re: Write once C and forth structs Hannu Vuolasaho <vuokkosetae@gmail.com> - 2014-08-02 15:40 +0300
      Re: Write once C and forth structs Bernd Paysan <bernd.paysan@gmx.de> - 2014-08-02 19:08 +0200
    Re: Write once C and forth structs hughaguilar96@yahoo.com - 2014-08-02 20:47 -0700
      Re: Write once C and forth structs hughaguilar96@yahoo.com - 2014-08-03 21:03 -0700
        Re: Write once C and forth structs "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-08-04 04:16 -0400
          Re: Write once C and forth structs Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-08-04 11:39 -0500
            Re: Write once C and forth structs Bernd Paysan <bernd.paysan@gmx.de> - 2014-08-04 22:35 +0200
              Re: Write once C and forth structs anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-08-05 12:33 +0000
                Re: Write once C and forth structs hughaguilar96@yahoo.com - 2014-08-05 20:31 -0700
                Re: Write once C and forth structs Raimond Dragomir <raimond.dragomir@gmail.com> - 2014-08-05 21:45 -0700
                Re: Write once C and forth structs Raimond Dragomir <raimond.dragomir@gmail.com> - 2014-08-05 21:45 -0700
                Re: Write once C and forth structs humptydumpty <ouatubi@gmail.com> - 2014-08-05 23:00 -0700
                Re: Write once C and forth structs "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-08-06 16:38 -0400
                Re: Write once C and forth structs hughaguilar96@yahoo.com - 2014-08-06 17:18 -0700
            Re: Write once C and forth structs "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-08-04 17:43 -0400
            Re: Write once C and forth structs Samuel DEVULDER <samuel-dot-devulder-at-laposte-dot-net> - 2014-08-05 08:26 +0200
              Re: Write once C and forth structs hughaguilar96@yahoo.com - 2014-08-05 20:23 -0700
                Re: Write once C and forth structs Samuel DEVULDER <samuel-dot-devulder-at-laposte-dot-net> - 2014-08-06 08:40 +0200
                Re: Write once C and forth structs hughaguilar96@yahoo.com - 2014-08-06 14:43 -0700
                Re: Write once C and forth structs Gerd Brix <gbrix@gmx.eu> - 2014-08-06 08:54 +0200

csiph-web