From 031c7941d7bd97b4acbf9bcd2513ed695b387ff2 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 17 May 2018 12:02:30 +0200 Subject: pkg/compiler: add optional builtin template type optional[T] [ val T void void ] [varlen] --- docs/syscall_descriptions_syntax.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/syscall_descriptions_syntax.md b/docs/syscall_descriptions_syntax.md index 47986651c..4708dc804 100644 --- a/docs/syscall_descriptions_syntax.md +++ b/docs/syscall_descriptions_syntax.md @@ -185,10 +185,7 @@ type filename string[filename] ## Type Templates -**Note: type templates are experimental, can have error handling bugs and are subject to change** - Type templates can be declared as follows: - ``` type buffer[DIR] ptr[DIR, array[int8]] type fileoff[BASE] BASE @@ -200,11 +197,18 @@ type nlattr[TYPE, PAYLOAD] { ``` and later used as follows: - ``` syscall(a buffer[in], b fileoff[int64], c ptr[in, nlattr[FOO, int32]]) ``` +There is builtin type template `optional` defined as: +``` +type optional[T] [ + val T + void void +] [varlen] +``` + ## Length You can specify length of a particular field in struct or a named argument by using `len`, `bytesize` and `bitsize` types, for example: -- cgit mrf-deployment