file: example.c

This is a C source file used to test cdoc.

license: 0BSD


function: swap

Exchange two objects of equal size.

param: p1

Pointer to the first object.

param: p2

Pointer to the second object.

param: size

The sizeof both objects.

note:

Objects p1 and p2 may point to overlapping memory. E.g swap(&foo, &foo, sizeof(foo)) is valid.

struct: string

POD type representing an array-of-char with a known size.

struct string
{
    char* data;
    size_t size;
};

union: foobar

A data packet sent over the wire from FooBar Inc.

union foobar
{
    uint32_t foo;
    float bar;
};

enum: color

todo:

Add more colors.

typedef enum
{
    RED = 0,
    BLUE = 1,
    GREEN = 2
} color;

typedef: colour

Convenient typedef for non-American software engineers.

typedef color colour;

function: get_color

Cdoc should be lenient with whitespace. Any amount of indenting should be allowed. Even with tabs.

return:

My favorite color.

macro: M_PER_KM


macro: KM

Convert meters into kilometers.

macro: NUM_FOOBAR

256 is a computer-ish number, right?

variable: foobars


union foobar foobars[NUM_FOOBAR];