On Fri, Jan 25, 2013 at 05:22:33PM +0000, Blue Swirl wrote:
> On Wed, Jan 23, 2013 at 5:09 PM, Eduardo Habkost <[email protected]> wrote:
> > On Wed, Jan 23, 2013 at 05:33:25PM +0100, Andreas Färber wrote:
[...]
> >> > - numa_fw_cfg = g_new0(uint64_t, 1 + max_cpus + nb_numa_nodes);
> >> > + numa_fw_cfg = g_new0(uint64_t, 1 + apic_id_limit + nb_numa_nodes);
> >> > numa_fw_cfg[0] = cpu_to_le64(nb_numa_nodes);
> >> > - for (i = 0; i < max_cpus; i++) {
> >> > + unsigned int cpu_idx;
> >>
> >> Beep.
> >
> > After so many rebases, I didn't even remember this variable declaration
> > was here.
> >
> > But, what prevents us from declaring variables only when they are being
> > used, in QEMU code? I didn't find anything on CODING_STYLE or HACKING.
>
> Here's one explanation:
> http://lists.nongnu.org/archive/html/qemu-devel/2012-05/msg03955.html
>
> Also IIRC Anthony gave a nice explanation once too but I can't find it now.
I'm not even looking for an explanation why[1]. I just expected to have
this requirement documented on CODING_STYLE or HACKING.
[1] Item 3 on Anthony's explanation is enough to me:
https://lists.nongnu.org/archive/html/qemu-devel/2012-05/msg04116.html
"3) It's not how the rest of QEMU is written. Consistency is the
most important purpose of Coding Style."
--
Eduardo