Why procedure returns 8 ( It's gonna be funny ) 
Author Message
 Why procedure returns 8 ( It's gonna be funny )

Hello everyone!
We've got a procedure that must return some value depending on passed
parameters, but there's a situation when it doesn't return any value and
suppose we forgot to write the RETURN statement in that case . Don't  you
think that it must return '0', in this case?
More fun: when we're adding parameter to the procedure it returns
unpredictable values .

PROGRAM
  MAP
     FI(*DECIMAL,?,?,?,?,?),BYTE,PROC
   END
W  DECIMAL(15,2)
   CODE
   MESSAGE(FI(W,0,0,0,0))             ! It show 8 instead of 0
!-------------------------------------------
FI    Procedure(p1,p2,p3,p4,p5)
    CODE
   ! Here goes some code
   ! and assume we forgot to write: Return( ReturnValue )

Regards
Ilia & Zaza
Tbilisi, Georgia



Tue, 05 Aug 2003 09:06:46 GMT  
 Why procedure returns 8 ( It's gonna be funny )
I think we need to see the code inside of FI().  I think the compiler
complains if you return without a parameter if one is specified.  The PROC
parameter means that the function can be called without getting the returned
value but I don't think it means that the procedure doesn't have to return
one.

Peter Gysegem
Beaver Creek Software

Quote:

>Hello everyone!
>We've got a procedure that must return some value depending on passed
>parameters, but there's a situation when it doesn't return any value and
>suppose we forgot to write the RETURN statement in that case . Don't  you
>think that it must return '0', in this case?
>More fun: when we're adding parameter to the procedure it returns
>unpredictable values .

>PROGRAM
>  MAP
>     FI(*DECIMAL,?,?,?,?,?),BYTE,PROC
>   END
>W  DECIMAL(15,2)
>   CODE
>   MESSAGE(FI(W,0,0,0,0))             ! It show 8 instead of 0
>!-------------------------------------------
>FI    Procedure(p1,p2,p3,p4,p5)
>    CODE
>   ! Here goes some code
>   ! and assume we forgot to write: Return( ReturnValue )

>Regards
>Ilia & Zaza
>Tbilisi, Georgia



Tue, 12 Aug 2003 01:32:48 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. K Sorry I am gonna swear here

2. nop-When am I ever gonna use this?

3. am i gonna go down in flames??

4. Procedure's return value

5. should read of procedure return a procedure ?

6. Why can't I use lsearch in a Tk procedure

7. What's gonna be in 5.5 ??

8. asm newbie's gonna get flamed!

9. Y'all must read this it's very funny :-)

10. The Smalltalk Store: Why we've been slow, and why we're getting better

11. (OT) This just gets funnier and funnier

12. module path:funny bug, funny solution

 

 
Powered by phpBB® Forum Software