> type ppp.c
#include <stdio.h>
#include <stdlib.h>
int global = 0;
int main(void) {
int local = 0;
static int staticint = 0;
int *mall;
int (*fx)(void);
fx = main;
mall = malloc(42); /* assume it worked */
printf("#sizeof pointer to local: %d
", (int)sizeof &local);
printf("#sizeof pointer to static: %d
", (int)sizeof &staticint);
printf("#sizeof pointer to malloc'd: %d
", (int)sizeof mall);
printf("#sizeof pointer to global: %d
", (int)sizeof &global);
printf("#sizeof pointer to main(): %d
", (int)sizeof fx);
free(mall);
return 0;
}
> tcc -mc ppp.c
Turbo C Version 2.01 ...
warnings about unused variables elided ...
Turbo Link Version 2.0 ...
> ppp
#sizeof pointer to local: 4
#sizeof pointer to static: 4
#sizeof pointer to malloc'd: 4
#sizeof pointer to global: 4
#sizeof pointer to main(): 2
> tcc -mm ppp.c
> ppp
#sizeof pointer to local: 2
#sizeof pointer to static: 2
#sizeof pointer to malloc'd: 2
#sizeof pointer to global: 2
#sizeof pointer to main(): 4
tcc -mc
generates code in the "compact" model; tcc -mm
generates code in the "medium" model
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…