Welcome! Log In Create A New Profile



Posted by chaospixel 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
July 14, 2006 08:12PM
what is the significance of declaring everything static in solar.c?
avatar Re: static?
July 23, 2006 06:48PM
In short, the static keyword prevents you from using the global variables or functions in another source file. Apart from the main function, the only other function that is not declared static is the void OpenGLInit(void) function.

If you had a larger programme that had more than one source file to compile, you could call it from the other source programme by either including the function declaration in that file but preceding it by the keyword extern.

This would satisfy the compiler and it won't complain that the function is not defined in that source file. However, if you tried that with a static function or variable, your source file would compile properly but the linker would complain.

Basically, if you don't declare something static, it is globally available to all functions and classes in your entire programme. If you DO declare something as static, it only has file scope, you can only use it in the file that it's declared.
avatar Re: static?
July 23, 2006 06:48PM
<deleted - duplicate post>
Sorry, only registered users may post in this forum.

Click here to login