DEV Community

Shaw
Shaw

Posted on

So... staitc is Sorta Shifty.

In a previous post I pondered that in the C programming language static only has one meaning.

Long story short I though that it meant "translation unit local". A term that effectively means that it is owned by the .c file or .o file and not the executable produced.

This turns out to be wrong. As I dove further into the c language I came upon a puzzling piece of code

int main(int argc, char *argv[static argc]) {
    // WTF. What the Function?
}
Enter fullscreen mode Exit fullscreen mode

In a state of panic I looked all over for what it meant. Google was being no help. Eventually however, I learned that it meant that there must be atleast argc elements in argv (there is argc+1).

This disproves my static theory.

That is all. Thanks!

Top comments (1)

Collapse
 
pauljlucas profile image
Paul J. Lucas

There are several obscure array features starting in C99.