Quick actions

cmd+k|ctrl+k

Navigation

Languages

C extension features

Snippet info

Language

C

Visibility

public

Author

evine

Created

2022-02-09T03:36:05.121752Z

Updated

2022-02-09T10:34:28.318554Z

#include <stdio.h>

#define auto __auto_type
#define overload __attribute__((overloadable))
#define ms_abi __attribute__((ms_abi))
#define packed __attribute__((packed))

typedef enum packed {
    apple = 300,
} Thing;

overload
void foo(int a) {
    printf("int: %i\n", a);
}

overload
void foo(double a) {
    printf("double: %g\n", a);
}

overload
void foo(char *a) {
    printf("char *: %s\n", a);
}

int main(void) {
    auto a = 3.05;
    auto b = 3;
    foo(a);
    foo(b);
    foo("hello");
    
    foo((int)sizeof(Thing));
    
    return 0;
}
INFO