mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
all: support [noreturn] fn abc() { for{} }
, mark panic/1 and exit/1with it too. (#10654)
This commit is contained in:
15
doc/docs.md
15
doc/docs.md
@@ -4763,6 +4763,21 @@ fn legacy_function() {}
|
||||
fn inlined_function() {
|
||||
}
|
||||
|
||||
// This function's calls will NOT be inlined.
|
||||
[noinline]
|
||||
fn function() {
|
||||
}
|
||||
|
||||
// This function will NOT return to its callers.
|
||||
// Such functions can be used at the end of or blocks,
|
||||
// just like exit/1 or panic/1. Such functions can not
|
||||
// have return types, and should end either in for{}, or
|
||||
// by calling other `[noreturn]` functions.
|
||||
[noreturn]
|
||||
fn forever() {
|
||||
for {}
|
||||
}
|
||||
|
||||
// The following struct must be allocated on the heap. Therefore, it can only be used as a
|
||||
// reference (`&Window`) or inside another reference (`&OuterStruct{ Window{...} }`).
|
||||
[heap]
|
||||
|
Reference in New Issue
Block a user