Talk:Static (keyword)
This article is rated C-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||
|
C99 parameter with static array size
[edit]In C99, you could use the static keyword in a new place: between the brackets of an array parameter.
void f(char a[static 100]) { }
It means the parameter a points to an array that has room for at least 100 chars. I suppose this information may help the compiler optimize the function, e.g. by prefetching data from a[99] which might cause a page fault if the array is not actually that large. In contrast, if you omitted the static keyword, then it would be OK to pass an array of any size.
If this article is intended to list all uses of the static keyword, then a description of this C99 feature should be properly sourced and added there. 85.131.109.176 (talk) 20:43, 11 September 2014 (UTC)
Move to "Static (C-language keyword)"
[edit]This would solve the template-issue. Boeing720 (talk) 02:18, 10 February 2018 (UTC)
- Oppose both your overuse of hyphens and a move. This relates to more than just C. —DIYeditor (talk) 02:20, 10 February 2018 (UTC)
Those languages in which the "Static" keyword have a different functionality, should have their own articles. This was not written but included in my idea. C/C++ could possibly go together, but JAVA and others which are very different should have Static articles of their own. Here I do not refer to language syntax, but to far more fundamental matters. JAVA is largely interpreted but for many platforms, but C/C++ are(is) platform depending and "compiling only". So if JAVA static means something different compared to C/C++ , it should have an article of it's own. Is this not the case, then the template should go instead, I think Boeing720 (talk) 00:32, 11 February 2018 (UTC)
- All the use of
static
in various modern programming languages originate and derive from the use in C - to specify a variable of program execution lifetime. -Miklcct (talk) 13:53, 16 September 2024 (UTC) If it is used on a function, it shares the same properties of astatic
variable in the same scope as well.