[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] libxc, libxenstore: make the headers C++-friendly

-    struct hvm_hw_cpu *new=h;
-    struct hvm_hw_cpu_compat *old=h;
+    struct hvm_hw_cpu *newcpu=(struct hvm_hw_cpu *)h;
+    struct hvm_hw_cpu_compat *old=(struct hvm_hw_cpu_compat *)h;

That's not really C++. But yes, I recognize that the alternative
would be an even uglier #ifdef.

Is this about reinterpret_cast<type>(h)? I'm not trying to turn a C header into a C++ header, I'm trying to make a C header usable with C++, obviously.

+    newcpu->error_code=old->error_code;
+    newcpu->pending_event=old->pending_event;
+    newcpu->tsc=old->tsc;
+    newcpu->msr_tsc_aux=0;

Here and above - if you already touch those, could you add
spaces around the = operators?

Of course.

-    } private;                                                          \
+    } rprivate;                                                          \

This is a no-go: In a public header, you can't change names like
this. Since the stuff under io/ isn't really tied to
__XEN_INTERFACE_VERSION__, I'm also not immediately seeing
how else you could adjust this.

That ammounts to not being able to use libxc with C++ if you ever use ring.h's DEFINE_RING_TYPES() macro (that is, if you ever use mem_events).

Razvan Cojocaru

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.