diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2023-07-04 19:07:30 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2023-09-12 16:31:52 +0200 |
commit | fc4398b4e1d18142a5c428a7c90484071a81ab9c (patch) | |
tree | b304a94e2b40454ac3dc8398a71f964387e6692d /doc/bird.sgml | |
parent | cc1099a04169b768cb4803686ee20423a6d3fede (diff) |
Filter: Better syntax for function return types
The C-style syntax does not really fit into rest of our syntax.
Diffstat (limited to 'doc/bird.sgml')
-rw-r--r-- | doc/bird.sgml | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/doc/bird.sgml b/doc/bird.sgml index 3fcf0025..3be266cb 100644 --- a/doc/bird.sgml +++ b/doc/bird.sgml @@ -539,7 +539,7 @@ include "tablename.conf";; Define a filter. You can learn more about filters in the following chapter. - <tag><label id="opt-function">function <m/type/ <m/name/ (<m/parameters/) <m/local variables/ { <m/commands/ }</tag> + <tag><label id="opt-function">function <m/name/ (<m/parameters/) [ -> <m/return type/ ] <m/local variables/ { <m/commands/ }</tag> Define a function. You can learn more about functions in the following chapter. <tag><label id="opt-protocol">protocol rip|ospf|bgp|<m/.../ [<m/name/ [from <m/name2/]] { <m>protocol options</m> }</tag> @@ -1294,21 +1294,21 @@ can group several statements to a single compound statement by using braces (<cf>{ <M>statements</M> }</cf>) which is useful if you want to make a bigger block of code conditional. -<p>BIRD supports functions, so that you don't have to repeat the same blocks of -code over and over. Functions can have zero or more parameters and they can have -local variables. You should always specify the function return type and always -return it. No-return functions and multiple-type returning functions are deprecated. -Direct recursion is possible. Function definitions look like this: +<p>BIRD supports functions, so that you don not have to repeat the same blocks +of code over and over. Functions can have zero or more parameters and they can +have local variables. If the function returns value, then you should always +specify its return type. Direct recursion is possible. Function definitions look +like this: <code> -function int name () +function name() -> int { int local_variable; int another_variable = 5; return 42; } -function pair with_parameters (int parameter) +function with_parameters(int parameter) -> pair { print parameter; return (1, 2); |