Hi
This program dies with a compiler error (function result not assigned).
program bar; function foo : integer; begin Writeln ('bar'); end; begin writeln (foo); end.
In previous GPC versions, a warning was generated. Any reason for turning it into an error? I guess some standard requires this - right?
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.bigfoot.com/~african_chief/
Prof A Olowofoyeku (The African Chief) wrote:
This program dies with a compiler error (function result not assigned).
program bar; function foo : integer; begin Writeln ('bar'); end; begin writeln (foo); end.
In previous GPC versions, a warning was generated. Any reason for turning it into an error? I guess some standard requires this - right?
I've turned many warnings into errors over the years, now I hit this one. ;-)
Yes, the standard requires it. Besides, such a function is really meaningless. Independently of the standard (i.e., also in GPC mode), I prefer to give errors in such case, and warnings for cases which *might* be problematic.
Is there any case where you actually use such a function? (Except, of course, when GPC would erroneously claim a function result wasn't assigned -- I've fixed one more such case, and I hope it was the last one; if not, please report.)
Frank
On 11 Feb 2003 at 3:44, Frank Heckenbach wrote:
[...]
I've turned many warnings into errors over the years, now I hit this one. ;-)
Yes, the standard requires it. Besides, such a function is really meaningless. Independently of the standard (i.e., also in GPC mode), I prefer to give errors in such case, and warnings for cases which *might* be problematic.
Is there any case where you actually use such a function? (Except, of course, when GPC would erroneously claim a function result wasn't assigned -- I've fixed one more such case, and I hope it was the last one; if not, please report.)
No, it wasn't a spurious report. There was a function where I didn't return a result (it is still work-in-progress - as are many other things in the affected unit). Assigning a default value is easy, so that isn't a major problem (well, at least, not until now).
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.bigfoot.com/~african_chief/