[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] QOM: why "klass" used instead of "class" ?
From: |
Andreas Färber |
Subject: |
Re: [Qemu-devel] QOM: why "klass" used instead of "class" ? |
Date: |
Thu, 01 Mar 2012 09:14:03 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120215 Thunderbird/10.0.2 |
Am 29.02.2012 10:05, schrieb 陳韋任:
> On Wed, Feb 29, 2012 at 10:59:54AM +0400, Michael Tokarev wrote:
>> On 29.02.2012 09:52, Evgeny Voevodin wrote:
>>> include/qemu/object.h:
>> []
>>> * void my_device_class_init(ObjectClass *klass, void *class_data)
>>> * {
>>> * DeviceClass *dc = DEVICE_CLASS(klass);
>>> * dc->reset = my_device_reset;
>>> * }
>>> *
>>>
>>> Why to use "klass", not "class"?
>>
>> Because in C++, "class" is a reserved word. It is quite typical idiom
>> to replace class with klass in (public) headers.
>
> I thought QEMU is written in C, right? Is there anything related to C++?
A while back there was a patch that added a C++ audio backend, for
instance. I didn't get around to cleaning the patch up yet though.
Objective-C is used for the Cocoa frontend.
At least our headers should work with such C-derived languages.
clazz is another common alternative if you don't like klass. ;)
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
- Re: [Qemu-devel] QOM: why "klass" used instead of "class" ?,
Andreas Färber <=