diff options
Diffstat (limited to 'language_description.md')
-rw-r--r-- | language_description.md | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/language_description.md b/language_description.md index 63041d5..1e24066 100644 --- a/language_description.md +++ b/language_description.md @@ -41,15 +41,14 @@ func malloc(size_t s) (void*, error) { /* What malloc is supposed to do */ return ptr, NIL; } onfail { - return 0, ESTACK; + return _, ESTACK; } ``` If something causes `malloc` to be uncallable, e.g. if there is insufficient stack space to hold its local variables, it simply returns a meaningless -pointer and a non-nil error value. Note that although we return "`0`" in the -example code above, the zero pointer is not guaranteed to be an invalid pointer -in e². +pointer and a non-nil error value. Returning the empty identifier `_` means +that the return value is undefined and may be uninitialized. Other functions may have different methods of failure. Some might return an error, so it might be natural to set their error return value to something like |