Forum Post: RE: bug with longchar

  • Thread starter Thread starter stern
  • Start date Start date
Status
Not open for further replies.
S

stern

Guest
The fact that you get different results when lv_data" is a CHAR variable vs. a LONGCHAR is a bug. HOWEVER, Mike is correct - you should not use the FINALLY block to do the associated (main) block's work. If for some reason there is an error in the associated block (unexpected in this case) that is thrown out (if you use ROUTINE-LEVEL ON ERROR UNDO, THROW), the RETURN statement in the finally block will conflict with this and the AVM will actually throw the error away!! This is not what you want. It also leaves the door open for code to return one value from the associated block and a different value from the FINALLY block. The FINALLY block value will win, BTW. If the method were VOID, even a simple RETURN statement in the FINALLY block would have (prior to 11.4) cancelled out any error thrown out of the associated block! We've fixed this case in 11.4. So it is good practice to make sure that the code in the FINALLY block will never conflict with code in the associated block. It should be used for cleanup, closing queries, freeing memptrs and the like, that should happen whether there is an error or not. Other languages don't even let you use a RETURN statement in the FINALLY block, which avoids all of these nasty issues. Sigh... Too late now. Laura

Continue reading...
 
Status
Not open for further replies.
Back
Top