]> git.draconx.ca Git - cdecl99.git/commitdiff
Add some examples to the manual.
authorNick Bowler <nbowler@draconx.ca>
Sat, 22 Oct 2011 16:06:10 +0000 (12:06 -0400)
committerNick Bowler <nbowler@draconx.ca>
Sun, 23 Oct 2011 00:20:58 +0000 (20:20 -0400)
doc/man/cdecl99.1

index 662858b7a7f8f37bf601619873921ffa7695b256..eca715f0d4e85b0ce0f35f17af416becee70a183 100644 (file)
@@ -159,6 +159,43 @@ possibilities.  The rule that is generally applied is that
 .Nm
 will choose the alternative with the simplest explanation.  Thus, f is
 interpreted as a function which takes an int and returns an int.
+.Sh EXAMPLES
+.Bl -tag -width Output:
+.It Input:
+.Li explain int x;
+.It Output:
+.Li declare x as int
+.It Input:
+.Li explain static int* x, y;
+.It Output:
+.Li declare x as static pointer to int
+.sp 0
+.Li declare y as static int
+.It Input:
+.Li explain extern int printf(const char *fmt, ...);
+.It Output:
+.Li declare printf as extern function (fmt as pointer to const char, ...) returning int
+.It Input:
+.Li explain size_t volatile * const (* restrict)[1][2][3]
+.It Output:
+.Li type restrict pointer to array 1 of array 2 of array 3 of const pointer to volatile int
+.It Input:
+.Li declare x as int
+.It Output:
+.Li int x
+.It Input:
+.Li type function (pointer to const char) returning size_t
+.It Output:
+.Li size_t (const char *)
+.It Input:
+.Li declare f as inline function (g as pointer to array 6 of pointer to const char) returning pointer to function (int, ...) returning int
+.It Output:
+.Li inline int (*f(const char *(*g)[6]))(int, ...)
+.It Input:
+.Li simplify const int const ((*restrict x))
+.It Output:
+.Li const int * restrict x
+.El
 .Sh AUTHORS
 Nick Bowler <nbowler@draconx.ca>
 .Sh COPYRIGHT