embedded systems developers tools, cross compilers
  Home  |   SwiftX Archive  |   SwiftForth Archive  |

Re: Why is 4+ legal?

From: Appert, Kevin <kevin.appert_at_lmco.com>
Date: Fri, 01 Jun 2001 09:13:59 -0700

     To deal with the ED class of problem on one project we had a rule that
numbers had to start with 0, like 0ED and NOTHING ELSE could start with a 0.
The first few integers 00, 01, 02, etc. were defined and the 0, 1 and 2
definitions removed. This caused problems for one of my colleagues who was
just learning C and carried the habit over where he learned what C thought
0321 meant the hard way. This was a system which only had HEX and DECIMAL
and no $ flag for hex numbers.
     You can't always tell the customer what he's doing wrong or change the
standard to avoid all awkwardness. ED frequently starts the editor and I
guess $ED could be some sort of editor string. Perhaps all hex numbers
should start with $ and NOTHING ELSE should.
     So 1+ is an increment and 4+ is a double number. 2+ is a coin toss
which caught me a while back when I didn't see it in some great code Leon
wrote. Maybe we should take + off the list of double number flags. Has
anyone ever used it or seen it used?

> ----------
> From: David Graham[SMTP:dgraham_at_GrahamAutomationInc.com]
> Reply To: swiftx_at_forth.com
> Sent: Wednesday, May 30, 2001 12:25 PM
> To: swiftx_at_forth.com
> Subject: [swiftx] Re: Why is 4+ legal?
>
>
> I wanted to report a peculiar feature of SwiftX 3.0, HC12
> version. The compiler accepts n+ or n-, where n is any numeric
> digit, as a legal definition, and leaves n 0 in the stack. I just caught
> by
> this when I mistyped 4 + as 4+.
>
> Regards,
> David Graham
> Graham Automation, Inc.
> PO Box 623
> McMinnville, OR 97128
> (503) 434-8636 Fax (503) 212-0181
> dgraham_at_GrahamAutomationInc.com
>
>
> > Hi David,
> >
> > That's an artifact of the standard Forth double number conversion.
> Always
> > be very careful with anything that might accidentally be converted to a
> > number! One of our competitor's systems defines two words, ED
> > and $ED which
> > conflict with hex numbers of the same value. Drives me crazy.
> >
> > Leon
>
>
> ----------------------------------------------------------------------
> swiftx_at_forth.com The SwiftX programming discussion email list
> To unsubscribe, send subject "unsubscribe swiftx" to listar_at_forth.com
> For help with listar commands, send subject "help" to listar_at_forth.com
> Archives are located at http://www.forth.com/swiftx -- check them out!
>
----------------------------------------------------------------------
swiftx_at_forth.com The SwiftX programming discussion email list
To unsubscribe, send subject "unsubscribe swiftx" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/swiftx -- check them out!
Received on Fri Jun 01 2001 - 09:22:11 PDT

This archive was generated by hypermail 2.2.0 : Wed Jan 07 2009 - 03:04:23 PST