On 28 March 2012 14:46, Andreas Färber <afaer...@suse.de> wrote: > Am 28.03.2012 15:40, schrieb Peter Maydell: >> On 26 March 2012 18:28, Andreas Färber <afaer...@suse.de> wrote: >> >>> +static void arm_cpu_reset(CPUState *c) >>> +{ >>> + ARMCPU *cpu = ARM_CPU(c); >>> + ARMCPUClass *class = ARM_CPU_GET_CLASS(cpu); >>> + >>> + class->parent_reset(c); >> >> I thought we were avoiding 'class' in favour of 'klass'? > > Max complained about that and no one argued against him, so I avoided it > in the .c file where it's not strictly necessary. It's really only > necessary in the headers. But I don't mind either way. > > For me, the convention is cpu_class => CPUClass, so it would be unwise > here, thus one of class, clazz, klass.
I don't particularly care but I'd rather we were consistent. Mostly the devices seem to go for short variable names, like: sc = I2C_SLAVE_GET_CLASS(dev); IDEDeviceClass *dc = IDE_DEVICE_GET_CLASS(dev); cdc = HDA_CODEC_DEVICE_GET_CLASS(codec); DeviceClass *dc = DEVICE_GET_CLASS(dev); VirtIOSerialPortClass *k = VIRTIO_SERIAL_PORT_GET_CLASS(port); and more rarely 'klass': ISADeviceClass *klass = ISA_DEVICE_GET_CLASS(dev); and never 'class' or 'foo_class'. (all examples obtained via 'git grep _GET_CLASS'.) That would suggest 'k' or 'acc' here. >>> +static const TypeInfo arm_cpu_type_info = { >>> + .name = TYPE_ARM_CPU, >>> + .parent = TYPE_CPU, >>> + .instance_size = sizeof(ARMCPU), >>> + .abstract = false, /* TODO Reconsider once cp15 reworked. */ >> >> As it happens I'm planning to create the per-implementation >> subclasses first and do the cp15 rework second. > > Suggest a rephrase? :) Dunno. /* TODO Replace with per-implementation subclasses later */ ? -- PMM