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


Groups > comp.lang.forth > #23898

Re: Structures in Forth

From Andrew Haley <andrew29@littlepinkcloud.invalid>
Subject Re: Structures in Forth
Newsgroups comp.lang.forth
References <92bd792c-21b0-4cde-a86e-22e330d935b6@googlegroups.com>
Message-ID <SPadnS8aI9Cfv1XMnZ2dnUVZ_rWdnZ2d@supernews.com> (permalink)
Date 2013-06-24 05:40 -0500

Show all headers | View raw


m.a.m.hendrix@tue.nl wrote:
> AFAIK (http://www.forth200x.org/ is inaccessible), +FIELD:
> has no support for alignment control.

That's correct.

> I've encountered a bad problem with this in my SDL library. Under
> Win64/Linux64 ints are 32 bit and pointers 64 bit. However, in a
> Windows structure pointers align on 4 bytes, while in a Linux struct
> for the same library that seems to be 8 bytes.  This, of course,
> results is pretty obnoxious segfaults.
> 
> Luckily I am using Anton Ertl's struct package so this was easy to
> fix (one line), once found. For 32bit Forths this may not be an
> issue yet, but I hope some foresight will be applied.
> 
> How would I have done this with ANS structures?

: +aligned ( x n - x')   dup >r 1- + r> and ;

( Win:)
: pfield   4 +aligned  1 cells +field ;
(Lin:)
: pfield   8 +aligned  1 cells +field ;

Andrew.

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


Thread

Structures in Forth m.a.m.hendrix@tue.nl - 2013-06-24 02:22 -0700
  Re: Structures in Forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-06-24 05:40 -0500
    Re: Structures in Forth m.a.m.hendrix@tue.nl - 2013-06-24 04:50 -0700
      Re: Structures in Forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-06-24 07:25 -0500
      Re: Structures in Forth Bernd Paysan <bernd.paysan@gmx.de> - 2013-06-24 14:29 +0200
        Re: Structures in Forth albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-06-24 13:17 +0000
        Re: Structures in Forth m.a.m.hendrix@tue.nl - 2013-06-24 06:35 -0700
          Re: Structures in Forth Bernd Paysan <bernd.paysan@gmx.de> - 2013-06-24 18:12 +0200
            Re: Structures in Forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-06-24 12:16 -0500
              Re: Structures in Forth Bernd Paysan <bernd.paysan@gmx.de> - 2013-06-24 20:55 +0200
      Re: Structures in Forth anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-06-24 15:35 +0000
      Re: Structures in Forth "Ed" <invalid@invalid.com> - 2013-06-25 19:42 +1000
  Re: Structures in Forth anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-06-24 15:10 +0000
    Re: Structures in Forth m.a.m.hendrix@tue.nl - 2013-06-24 23:39 -0700
      Re: Structures in Forth anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-06-27 17:49 +0000
        Re: Structures in Forth Alex McDonald <blog@rivadpm.com> - 2013-06-27 11:29 -0700
  Re: Structures in Forth anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-06-24 15:20 +0000
    Re: Structures in Forth m.a.m.hendrix@tue.nl - 2013-06-24 23:46 -0700
  Re: Structures in Forth Michael L Gassanenko <m_l_g3@yahoo.com> - 2013-06-27 02:08 -0700
    Re: Structures in Forth m.a.m.hendrix@tue.nl - 2013-06-27 03:27 -0700
      Re: Structures in Forth stephenXXX@mpeforth.com (Stephen Pelc) - 2013-06-27 10:41 +0000
      Re: Structures in Forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-06-27 07:28 -0500
      Re: Structures in Forth Bernd Paysan <bernd.paysan@gmx.de> - 2013-06-27 16:34 +0200

csiph-web