|
From: | James Courtier-Dutton |
Subject: | Re: 0.94 will appear soon |
Date: | Mon, 19 Jan 2004 15:53:59 +0000 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6b) Gecko/20031208 Thunderbird/0.4 |
address@hidden wrote:
* I just stumbled on this code (in 0.93), netboot/timer.c. ----------------------------------------- unsigned long currticks(void) { static unsigned long clocks_per_tick; unsigned long clocks_high, clocks_low; unsigned long currticks; if (!clocks_per_tick) { clocks_per_tick = calibrate_tsc(); printf("clocks_per_tick = %d\n", clocks_per_tick); } ------------------------------------------ Shouldn't clock_per_tick be inited to zero? If so, is that fixed in the new version?
clock_per_tick is declared as "static" but not given a constant value. But as it is "static" it is therefore automatically given a value of 0. So, it is in fact a definition, I.E. It is automatically give a value of 0 (unless specifically given a different value) the first time one calls the function containing it.
i.e. static unsigned long clocks_per_tick; is exactly the same as static unsigned long clocks_per_tick = 0; So, no fix necassary. Cheers James
[Prev in Thread] | Current Thread | [Next in Thread] |