Name: Anonymous 2010-10-16 17:23
I can see why you would want static variables in functions but what's the point of static globals?
static int myglobal; defined in header "defs.h", and files "main.c" and "input.c" both include "defs.h". Then they both get their own separate copy of myglobal, because it has no linkage they are not combined into one object.#include <stdio.h>
struct x { long x; };
int main(int argc, char *argv[])
(
struct x x;
x.x = strtol(argv[i]);
if (x.x) goto x;
return 0;
x:
return 1;
}
(defun f (car) (car car))
static. The purpose is to have an object that can be shared between functions in the translation unit, but whose name is invisible to other translation units.