Skip to content

Instantly share code, notes, and snippets.

@Gydo194
Created July 22, 2018 17:32
Show Gist options
  • Save Gydo194/25ee01364e9f1a99cab5b10790ad3cfd to your computer and use it in GitHub Desktop.
Save Gydo194/25ee01364e9f1a99cab5b10790ad3cfd to your computer and use it in GitHub Desktop.
C Multi-Type struct implementation with run-time type information
//rtti_mt.h
//Run Time Type Information enabled Multi Type variable implementation
//Author: Gydo194
//2207181714
#pragma once
struct rtti_mt_t;
typedef struct rtti_mt_t rtti_mt_t;
struct rtti_mt_t
{
enum
{
INT,
DOUBLE,
CHAR,
STRING
} type;
union
{
int int_value;
double double_value;
char char_value;
char *string_value;
} value;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment