Skip to contentSkip to conversation

QOM: why "klass" used instead of "class" ?

Qemu-devel Evgeny Voevodin 5 participants 8 messages Feb 29, 2012 – Mar 1, 2012

lore
Share & tools
lore
#0 lore raw

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

Signature · 5 lines
Kind regards,
Evgeny Voevodin,
Leading Software Engineer,
ASWG, Moscow R&D center, Samsung Electronics
e-mail: [email protected]
#1 lore raw
Quoted 1 line · Evgeny Voevodin

include/qemu/object.h:

[]

Quoted 8 lines

* 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

#2 lore raw
Quoted 10 lines · Michael Tokarev
Quoted 1 line · Evgeny Voevodin

include/qemu/object.h:

[]

Quoted 7 lines

* void my_device_class_init(ObjectClass *klass, void *class_data)
* {
* DeviceClass *dc = DEVICE_CLASS(klass);
* dc->reset = my_device_reset;
* }
*

Quoted 4 lines
Quoted 1 line

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

Signature · 5 lines
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
#3 lore raw
Quoted 11 lines · 陳韋任
Quoted 10 lines · Michael Tokarev
Quoted 1 line · Evgeny Voevodin

include/qemu/object.h:

[]

Quoted 7 lines

* void my_device_class_init(ObjectClass *klass, void *class_data)
* {
* DeviceClass *dc = DEVICE_CLASS(klass);
* dc->reset = my_device_reset;
* }
*

Quoted 4 lines
Quoted 3 lines
Quoted 1 line

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

Signature · 5 lines
Kind regards,
Evgeny Voevodin,
Leading Software Engineer,
ASWG, Moscow R&D center, Samsung Electronics
e-mail: [email protected]
#4 lore raw
In reply to 陳韋任

Am 29.02.2012 10:05, schrieb 陳韋任:

Quoted 11 lines · Michael Tokarev
Quoted 10 lines · Evgeny Voevodin
Quoted 1 line

include/qemu/object.h:

[]

Quoted 7 lines

* void my_device_class_init(ObjectClass *klass, void *class_data)
* {
* DeviceClass *dc = DEVICE_CLASS(klass);
* dc->reset = my_device_reset;
* }
*

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

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

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#5 lore raw
Quoted 14 lines · Andreas F?rber

Am 29.02.2012 10:05, schrieb ???:

Quoted 13 lines · Michael Tokarev
Quoted 12 lines · Evgeny Voevodin
Quoted 1 line

include/qemu/object.h:

[]

Quoted 8 lines

* 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"?

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

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.

Quoted 6 lines

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

Signature · 1 line
mailto:[email protected]
#6 lore raw

Am 01.03.2012 09:17, schrieb malc:

Quoted 19 lines · Andreas F?rber
Quoted 18 lines

Am 29.02.2012 10:05, schrieb ???:

Quoted 16 lines · Michael Tokarev
Quoted 14 lines · Evgeny Voevodin
Quoted 1 line

include/qemu/object.h:

[]

Quoted 8 lines

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

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

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

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#7 lore raw
Quoted 26 lines · Andreas F?rber

Am 01.03.2012 09:17, schrieb malc:

Quoted 25 lines · Andreas F?rber
Quoted 23 lines

Am 29.02.2012 10:05, schrieb ???:

Quoted 11 lines · Michael Tokarev
Quoted 10 lines · Evgeny Voevodin
Quoted 1 line

include/qemu/object.h:

[]

Quoted 7 lines

* void my_device_class_init(ObjectClass *klass, void *class_data)
* {
* DeviceClass *dc = DEVICE_CLASS(klass);
* dc->reset = my_device_reset;
* }
*

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

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.

Quoted 6 lines
Quoted 2 lines

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)

Signature · 1 line
mailto:[email protected]