Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Forth Mac > Re: RfD: Third ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 17 Topic 129 of 161
Post > Topic >>

Re: RfD: Third draft of Structures

by anton@[EMAIL PROTECTED] (Anton Ertl) Sep 2, 2006 at 04:25 PM

stephenXXX@[EMAIL PROTECTED]
 (Stephen Pelc) writes:
>Mitch Bradley wrote the following about structure alignment:
....
>Since I do much more (b) than (a), I prefer a structure definition
>basis
>that is fundamentally unaligned. It is much easier to add alignment 
>than to undo it."

He also wrote that he liked (the semantics of) Gforth's FIELD, which
does sup****t, but not enforce alignment.

In particular, if you want unaligned fields, the only cost is that you
have to write an additional "1" per field.  I would like to see a
rationale by you why you consider that worse than your proposal.  The
only rationale I have seen by you is that you have had problems with
C; but Gforth is not C, and Gforth's FIELD does something different
than C; in particular:

|field      ( align1 offset1 align size "name" -  align2 offset2 )
|
|Create a field NAME with offset OFFSET1, and the type given by ALIGN
|SIZE. OFFSET2 is the offset of the next field, and ALIGN2 is the
|alignment of all fields.

If you want an unaligned 4-byte field, you write

1 4 field <name>

[Of course the name would have to be changed, and the specification
adjusted to a more standard-do***ent style]

>The recommended field type definers are:
>  CFIELD:  1 character
>  IFIELD:  native integer (single cell)
>  FFIELD:  native float

Fill in the blank:

C@[EMAIL PROTECTED]
      F@[EMAIL PROTECTED]
      @[EMAIL PROTECTED]
       
C!      F!      !       
CFIELD: FFIELD:

Calling that word that fills the blank IFIELD: would be a severe
mistake, in breaking the usual Forth conventions and making both this
word hard to remember as well as all others that deal with single
cells.  Ok, so this is would not be the first time that this mistake
is made (the order of locals in LOCALS| comes to mind), but we should
not repeat this mistake.

I see two possible solutions:

1) Call the single-cell word FIELD: and the general word differently.

2) Only propose the general FIELD:, but not the type-specific words.

fup2 clf.

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2006: http://www.complang.tuwien.ac.at/anton/euroforth2006/
 




 17 Posts in Topic:
RfD: Third draft of Structures
stephenXXX@[EMAIL PROTECT  2006-08-30 10:03:23 
Re: RfD: Third draft of Structures
anton@[EMAIL PROTECTED]   2006-09-02 16:25:43 
Re: Third draft of Structures
"Charles Melice"  2006-10-03 16:25:26 
Re: Third draft of Structures
"jacko" <jac  2006-10-03 15:23:33 
Re: Third draft of Structures
"Charles Melice"  2006-10-04 14:23:36 
Naming of Standard words
"Ed" <nospam  2006-10-05 12:34:42 
Re: Naming of Standard words
"Charles Melice"  2006-10-05 11:29:08 
Re: Third draft of Structures
"jacko" <jac  2006-10-03 15:32:49 
Re: Naming of Standard words
"slava@[EMAIL PROTEC  2006-10-04 20:32:28 
Re: Naming of Standard words
ward@[EMAIL PROTECTED] (  2006-10-05 07:01:33 
Re: Naming of Standard words
"J Thomas" <  2006-10-05 05:13:43 
Re: Naming of Standard words
"slava@[EMAIL PROTEC  2006-10-05 10:45:16 
Re: Naming of Standard words
Elizabeth D Rather <er  2006-10-05 12:19:50 
Re: Third draft of Structures
"Ian Osgood" &l  2006-10-20 07:19:16 
Re: Third draft of Structures
Bernd Paysan <bernd.pa  2006-10-20 18:18:21 
Re: Third draft of Structures
"Ed" <nospam  2006-10-23 15:10:40 
Re: Third draft of Structures
"Tim Trussell"   2006-10-23 08:19:00 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 14:06:55 CST 2008.