prof-braino / propforth

Automatically exported from code.google.com/p/propforth
3 stars 0 forks source link

add37 with no parameter gives no error #200

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

: add37 37 + ;

add37  (with no value on the stack) 

give no stack underflow error

37 + with notihng on stack does give underflow error.

Reported by kids at workshop.

Original issue reported on code.google.com by prof.bra...@gmail.com on 30 Jun 2013 at 4:14

GoogleCodeExporter commented 8 years ago
The top element of the stack is buffered.  
Error checking is not performed until the top element is USED, so:

: add37 37 + . ;

I.E. including dot . to display the top element; would report an error. 

Just adding 37 and leaving it on the stack doesn't affect anything, so in 
practice this doesn't have to be reported as an error until the result is used. 
 So the original error steps are an arbitrary example and will not happen in an 
application. 

This was a design decision, waiting on the error checking until use gives about 
a 30% performance increase. 

By design, no change.

Original comment by prof.bra...@gmail.com on 29 Aug 2013 at 1:17