Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 630 Bytes

class.md

File metadata and controls

39 lines (29 loc) · 630 Bytes

class

table of content

1. C data structures and types

Example of creating custom run-time type information

struct some_data
{
    struct some_data* type;
}

struct some_data
{
    int of_type(void* ptr);
}

extern struct some_data some_data_type;

int of_type(void* ptr)
{
    struct some_data* type = &some_data_type;
    struct some_data* ptr = (struct some_data*)ptr;
    return ptr->type == type;
}

struct some_data some_data_type =
{
    .of_type = of_type
};

^