Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
It isn't usually compulsory but it makes sense to.
A static variable retains it's value between calls to the function, normally a local variable is lost when the function finishes. As such, it should hold a sensible value so the first time the function is called, it already has something in it.
I don't understand the exact meaning of "initialize static variables during compile time". By C specification, static variables are zeroed at application startup, an action that obviously not occurs "at compile time".
What would be the alternative? I think only disabling initialization of all or part of the static variables, which is an option with some compilers.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.