Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
If I recall the C standard correctly, this is only true for static arrays. Since cpu_sign isn't static, the remainder of the array (1 to 12) is undefined.
carbonBased wrote:
If I recall the C standard correctly, this is only true for static arrays. Since cpu_sign isn't static, the remainder of the array (1 to 12) is undefined.
According to both of my references, K&R C and C99, if there are fewer initializers than members of an aggregate (which includes arrays), then remaining members are implicity initialized to zero, the same as static aggregate members are.
A lot of compilers don't fully support C99 yet (unfortunately), but if it's listed in K&R... and empirical evidence shows that GCC certainly behaves this way.
The size increase you get when you initialise variables is small compared to the benefit you get from maintainability. Of course I wouldn't recommend intialising entire arrays (like page tables), but for small arrays like this a little benefit goes a long way in the future.
I say that succession planning holds the key to producing a stable and robust OS. If your current kernel *only just* manages to run, then what hope do future versions of your OS have?
We don't want to re-invent M$Win here.
Last edited by Da_Maestro on Sun Dec 18, 2005 12:00 am, edited 1 time in total.
Two things are infinite: The universe and human stupidity. But I'm not quite sure about the universe.
--- Albert Einstein