scc

A fork of https://git.simple-cc.org/scc/ for Qute

git clone https://git.8pit.net/scc.git

 1#include <assert.h>
 2#include <stddef.h>
 3#include <stdio.h>
 4
 5/*
 6output:
 7NULL = 0
 8end:
 9*/
10
11typedef struct test Test;
12
13struct test {
14	int a, b, c;
15	char d;
16} test = {
17	.a = 1,
18	.b = 2,
19	.c = 3,
20	.d = 4,
21};
22
23int
24main()
25{
26	wchar_t wc = L'c';
27	char *q, *p = (char *) &test;
28
29	printf("NULL = %p\n", NULL);
30
31	p += offsetof(Test, d);
32
33	assert(sizeof(size_t) == sizeof(ptrdiff_t));
34	assert(wc == L'c');
35	assert(*p == 4);
36	assert(offsetof(Test, d) > offsetof(Test, a));
37	assert(offsetof(Test, d) > offsetof(Test, b));
38	assert(offsetof(Test, d) > offsetof(Test, c));
39	assert(sizeof(sizeof(int)) == sizeof(size_t));
40	assert(sizeof(p - q) == sizeof(ptrdiff_t));
41
42	return 0;
43}