Nov. 28th, 2012

#if 0
#include <stdbool.h>
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

static enum bool {
	true = 0xdead, false = 0xbeaf
} bool;

static enum cast {
	const_cast,
	dynamic_cast,
	reinterpret_cast,
	static_cast
} cast;

static struct class {
	struct class *namespace;
	int explicit;
	int friend;
	int mutable;
	int private;
	int protected;
	int public;
	int virtual;
} class;

static catch()
{
	return 0;
}

static try()
{
	return 0;
}

static throw()
{
	return 0;
}

static delete()
{
	return 0;
}

static export()
{
	return 0;
}

static usage(str)
	const char *str;
{
	fprintf(stderr, "Usage: %s id type op\n", str);
	exit(EXIT_FAILURE);
}

main(argc, argv)
	char *argv[];
{
	void *new = &class;
	char *typeid, *typename, *operator;
	int this;
	int using;

	if (4 > argc)
		usage(argv[0]);

	class.namespace = new;
	typeid = argv[1];
	typename = argv[2];
	operator = argv[3];
	this = !strcmp(typename, "this");
	using = atoi(typeid);
	printf("ID#%d is %s\n", using, this ? "mine" : "yours");
	return 0;
}

Profile

Anton Salikhmetov

November 2018

S M T W T F S
    123
45678 910
11121314151617
18192021222324
252627282930 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 8th, 2025 02:19 am
Powered by Dreamwidth Studios