Re: About -4518 again
Posted in 1994
>From: evdh@csl.sni.be (Eric Van der Hulst) >Subject: About -4518 again >Date: 6 May 1994 11:06:29 GMT >X-Informix-List-Id: <news.6634> >gaukur@rhi.hi.is (Kristjan Gaukur Kristjansson) says: >>I'm using I4gl 4.10.UD2 and the following program crashes. Any explanations? >>Should the 'wordwrap' function be avoided? > >I'm glad somebody mentions error 4518. I've just lost 4 days and brought >down our whole database ( where was the backup? .. right ) searching for >this error. >I'm working with Informix 4.0 and 4GL. >My experiences: > - The error messages manual 5.0 talks about functions returning >long character strings, but also mentions two bugs in 4.0 and 4.1 regarding >concatenation of strings ( use CLIPPED ) and CASE for characters variables. >All very awkward! > ... >I searched and found that it must be the stack that is not correctly >freed when the function are left. I made following changes > - Eliminate cases where you use a call of a function as value > without storing it into a variable ( f.e. RETURN fctname() ) > - Eliminate the small functions and put the code into the > next level ( there goes my 'structured programming') >this is the worst programming language I've ever seen (or at least the >compiler is). >Anyone for comments? The only observation I can make is that both 4.12 and 6.00 I4GL have had this problem eliminated -- you cannot even get error -4518 (or -4517) out of a program recompiled under 4.12 or 6.00. You might manage to run out of memory, but in general you won't because there are support routines in place to ensure that the stack is properly cleaned up. As you deduced, it is returning strings from functions which causes the trouble, in conjunction with inadequate cleaning up. The primary problem with: CASE stringvariable WHEN "abcde" .... END CASE was cleared up in either version 4.10 or version 4.11, but problems with RETURN function_name(), WORDWRAP, CLIPPED, string concatenation remained. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>