aboutsummaryrefslogtreecommitdiff
path: root/doc/language
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-22 15:12:43 +0000
committer_ov4 <ov4@ov4.org>2026-10-22 15:21:11 +0000
commit98ef8bc4dfcebe44eece933ff0affc776b7199dd (patch)
treed02ffca5fd65852344a3e032bfbd3a4638c79dac /doc/language
parent8b6ba7222d9990bc19e355eabcf046a7ea773545 (diff)
fix(codegen): raise a runtime error when a FUNCTION ends without RETURN
Report the function and its header line, then throw, instead of silently returning zero. FUNCTION MAIN keeps its implicit result. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Diffstat (limited to 'doc/language')
-rw-r--r--doc/language/keyword/cpsc-keyword-function.7.md2
1 files changed, 1 insertions, 1 deletions
diff --git a/doc/language/keyword/cpsc-keyword-function.7.md b/doc/language/keyword/cpsc-keyword-function.7.md
index a7de9a4..d49a07d 100644
--- a/doc/language/keyword/cpsc-keyword-function.7.md
+++ b/doc/language/keyword/cpsc-keyword-function.7.md
@@ -15,7 +15,7 @@ ENDFUNCTION
# DESCRIPTION
-Call a function in an expression as `name(arguments)`. A call may precede its top-level definition. RETURNS specifies the result type; omitting it defaults to INTEGER. RETURN supplies a value of that type. Whole-array results are unsupported.
+Call a function in an expression as `name(arguments)`. A call may precede its top-level definition. RETURNS specifies the result type; omitting it defaults to INTEGER. RETURN supplies a value of that type. If execution reaches ENDFUNCTION without a RETURN, a run-time error is reported and an exception is thrown (the top-level MAIN is exempt). Whole-array results are unsupported.
As a compiler extension, `name(arguments)` may also be a complete statement that discards the result. This differs from guide section 8.2, which requires function calls to occur within expressions. Built-in functions support the same form.