From 6a505121fc997e6f21d26f8c8656f99e58faaaab Mon Sep 17 00:00:00 2001 From: fche Date: Sat, 3 Sep 2005 16:52:41 +0000 Subject: 2005-09-03 Frank Ch. Eigler PR 1292, by popular request. * parse.cxx (parse_functiondecl): Allow optional value/param type declarations. * stap.1.in: Document this. * tapset/*.stp: Convert most functions accordingly. * testsuite/parseok/twelve.stp, semok/seven.stp, semko/twenty.stp: Test this. --- stap.1.in | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'stap.1.in') diff --git a/stap.1.in b/stap.1.in index 12fcad52..13f02e13 100644 --- a/stap.1.in +++ b/stap.1.in @@ -315,8 +315,18 @@ function thisfn (arg1, arg2) { return arg1 + arg2 } .ESAMPLE -Note the usual absence of type declarations, which are instead -inferred by the translator. Functions may call others or themselves +Note the general absence of type declarations, which are instead +inferred by the translator. However, if desired, a function +definition may include explicit type declarations for its return value +and/or its arguments. This is especially helpful for embedded-C +functions. In the following example, the type inference engine need +only infer type type of arg2 (a string). +.SAMPLE +function thatfn:string (arg1:long, arg2) { + return string(arg1) . arg2 +} +.ESAMPLE +Functions may call others or themselves recursively, up to a fixed nesting limit. This limit is defined by a macro in the translated C code and is in the neighbourhood of 30. -- cgit