All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] QOM: why "klass" used instead of "class" ?
@ 2012-02-29  5:52 Evgeny Voevodin
  2012-02-29  6:59 ` Michael Tokarev
  0 siblings, 1 reply; 8+ messages in thread
From: Evgeny Voevodin @ 2012-02-29  5:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: Dmitry Solodkiy

include/qemu/object.h:

* Once all of the parent classes have been initialized, 
#TypeInfo::class_init
  * is called to let the class being instantiated provide default 
initialize for
  * it's virtual functions.  Here is how the above example might be modified
  * to introduce an overridden virtual function:
  *
  * <example>
  *   <title>Overriding a virtual function</title>
  *   <programlisting>
  * #include "qdev.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"?

-- 
Kind regards,
Evgeny Voevodin,
Leading Software Engineer,
ASWG, Moscow R&D center, Samsung Electronics
e-mail: e.voevodin@samsung.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] QOM: why "klass" used instead of "class" ?
  2012-02-29  5:52 [Qemu-devel] QOM: why "klass" used instead of "class" ? Evgeny Voevodin
@ 2012-02-29  6:59 ` Michael Tokarev
  2012-02-29  9:05   ` 陳韋任
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Tokarev @ 2012-02-29  6:59 UTC (permalink / raw)
  To: Evgeny Voevodin; +Cc: qemu-devel, Dmitry Solodkiy

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.

/mjt

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] QOM: why "klass" used instead of "class" ?
  2012-02-29  6:59 ` Michael Tokarev
@ 2012-02-29  9:05   ` 陳韋任
  2012-02-29  9:22     ` Evgeny Voevodin
  2012-03-01  8:14     ` Andreas Färber
  0 siblings, 2 replies; 8+ messages in thread
From: 陳韋任 @ 2012-02-29  9:05 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: qemu-devel, Evgeny Voevodin, Dmitry Solodkiy

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++?

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] QOM: why "klass" used instead of "class" ?
  2012-02-29  9:05   ` 陳韋任
@ 2012-02-29  9:22     ` Evgeny Voevodin
  2012-03-01  8:14     ` Andreas Färber
  1 sibling, 0 replies; 8+ messages in thread
From: Evgeny Voevodin @ 2012-02-29  9:22 UTC (permalink / raw)
  To: 陳韋任; +Cc: Michael Tokarev, qemu-devel, Dmitry Solodkiy

On 29.02.2012 13:05, 陳韋任 wrote:
> 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?

Actually, it is, but idiom...

-- 
Kind regards,
Evgeny Voevodin,
Leading Software Engineer,
ASWG, Moscow R&D center, Samsung Electronics
e-mail: e.voevodin@samsung.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] QOM: why "klass" used instead of "class" ?
  2012-02-29  9:05   ` 陳韋任
  2012-02-29  9:22     ` Evgeny Voevodin
@ 2012-03-01  8:14     ` Andreas Färber
  2012-03-01  8:17       ` malc
  1 sibling, 1 reply; 8+ messages in thread
From: Andreas Färber @ 2012-03-01  8:14 UTC (permalink / raw)
  To: 陳韋任
  Cc: Michael Tokarev, qemu-devel, Evgeny Voevodin, Dmitry Solodkiy

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] QOM: why "klass" used instead of "class" ?
  2012-03-01  8:14     ` Andreas Färber
@ 2012-03-01  8:17       ` malc
  2012-03-01  8:28         ` Andreas Färber
  0 siblings, 1 reply; 8+ messages in thread
From: malc @ 2012-03-01  8:17 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Evgeny Voevodin, Michael Tokarev, qemu-devel,
	陳韋任,
	Dmitry Solodkiy

On Thu, 1 Mar 2012, Andreas F?rber wrote:

> 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.
> 

The real reason, ofcourse, is that germans are taking over the world,
nothing new here.

> 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. ;)
> 

-- 
mailto:av1474@comtv.ru

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] QOM: why "klass" used instead of "class" ?
  2012-03-01  8:17       ` malc
@ 2012-03-01  8:28         ` Andreas Färber
  2012-03-01  8:29           ` malc
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Färber @ 2012-03-01  8:28 UTC (permalink / raw)
  To: malc
  Cc: Evgeny Voevodin, Michael Tokarev, qemu-devel,
	陳韋任,
	Dmitry Solodkiy

Am 01.03.2012 09:17, schrieb malc:
> On Thu, 1 Mar 2012, Andreas F?rber wrote:
> 
>> 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.
>>
> 
> The real reason, ofcourse, is that germans are taking over the world,
> nothing new here.

Actually the Haiku patch was by a Swiss and Anthony is American I guess.

In German it would be Klasse. ;)

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] QOM: why "klass" used instead of "class" ?
  2012-03-01  8:28         ` Andreas Färber
@ 2012-03-01  8:29           ` malc
  0 siblings, 0 replies; 8+ messages in thread
From: malc @ 2012-03-01  8:29 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Evgeny Voevodin, Michael Tokarev, qemu-devel,
	陳韋任,
	Dmitry Solodkiy

On Thu, 1 Mar 2012, Andreas F?rber wrote:

> Am 01.03.2012 09:17, schrieb malc:
> > On Thu, 1 Mar 2012, Andreas F?rber wrote:
> > 
> >> 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.
> >>
> > 
> > The real reason, ofcourse, is that germans are taking over the world,
> > nothing new here.
> 
> Actually the Haiku patch was by a Swiss and Anthony is American I guess.
> 
> In German it would be Klasse. ;)

Ich weiss das >B)

-- 
mailto:av1474@comtv.ru

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-03-01  8:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-29  5:52 [Qemu-devel] QOM: why "klass" used instead of "class" ? Evgeny Voevodin
2012-02-29  6:59 ` Michael Tokarev
2012-02-29  9:05   ` 陳韋任
2012-02-29  9:22     ` Evgeny Voevodin
2012-03-01  8:14     ` Andreas Färber
2012-03-01  8:17       ` malc
2012-03-01  8:28         ` Andreas Färber
2012-03-01  8:29           ` malc

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.