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


Groups > comp.lang.forth > #23898

Re: Structures in Forth

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail
NNTP-Posting-Date Mon, 24 Jun 2013 05:40:02 -0500
Sender Andrew Haley <aph@zebedee.pink>
From Andrew Haley <andrew29@littlepinkcloud.invalid>
Subject Re: Structures in Forth
Newsgroups comp.lang.forth
References <92bd792c-21b0-4cde-a86e-22e330d935b6@googlegroups.com>
User-Agent tin/1.9.2-20070201 ("Dalaruan") (UNIX) (Linux/3.8.13-100.fc17.x86_64 (x86_64))
Message-ID <SPadnS8aI9Cfv1XMnZ2dnUVZ_rWdnZ2d@supernews.com> (permalink)
Date Mon, 24 Jun 2013 05:40:02 -0500
Lines 26
X-Trace sv3-esnu6nkN3HlQ6sYYQmpN+09kNrwqjDlZMcYVG5OLZZKQOSouQmNoHt0IMXGJIXzEN1vR4W6v6BiP/eD!7ovR17NSGVQ5U2YAm+H1sbmljZVGKAxSBs0PRmHa/3XSc7a23bAkPiaIJ3YTGD6yx33qmPGh4fQ6!nTb3XbGLEpc=
X-Complaints-To www.supernews.com/docs/abuse.html
X-DMCA-Complaints-To www.supernews.com/docs/dmca.html
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 1937
Xref csiph.com comp.lang.forth:23898

Show key headers only | 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