Difference between revisions of "Template:Csig"

From Maths
Jump to: navigation, search
(Added pre section, documentation and examples, leaving "sample" at top for now due to laziness)
m (Adding template:ctd - for typedefs)
 
Line 72: Line 72:
 
* [[template:ckw]] - used within csig or cs
 
* [[template:ckw]] - used within csig or cs
 
** [[template:ckw_t]] - standalone version
 
** [[template:ckw_t]] - standalone version
 +
* [[template:ctd]] - typedefs
 +
** [[template:ctd_t]] - standalone version
  
 
</noinclude>
 
</noinclude>

Latest revision as of 08:40, 1 October 2017

int printf()

Usage

Currently supports up to 6 arguments, you may use pre and post to make things appear before and after (with a space between them and the body, if present), arguments go as follows:

  1. return or type (eg int)
  2. symbol name (eg printf)
  3. arg1 - type (eg const char*)
    • If not present, then no brackets are rendered after the symbol name, for a variable definition
    • If present but empty then brackets are shown, this is how you'd achieve a function with no arguments over a variable
  4. arg1 - name
  5. arg2 - type
  6. arg2 - name
  7. arg3 - type
  8. arg4 - name

and so on.

An argument is considered present if the type/name arguments are not both empty, so an empty type with the name as ... is valid, for example varadic functions (c-style)

Examples

  • int printf(const char* format, ...)
  • int printf(const char* format, ...)
  • int errno __attribute__((aligned(16)))
  • pid_t getpid()
  • long:
    • int lots_of_args(a b, c d, e f, g h) __attribute__((noreturn))

Family

Think of any *_t versions as "template" - to be used alone, without the _t at the end they may be styling (only csig and cs are designed to be used alone and lack a _t to indicate this)