Coding style, C++ compatible code (was Re: [Qemu-devel] [PATCH 02/22] eepro100: cast a void * makes no sense)
Stefan,
I'm with you 100 percent. I already complained to this group a couple of months ago about the void* casting issue (and also using "private" as a structure element name as that barfs C++ as well -- there are others.)
For my situation, these problems within C-language source files are not an issue but when they occur inside a QEMU header file that I must include from my C++ device models, my compilations fail. Consequently, I have a whole series of patch files to the QEMU source that I have to apply to correct these (trivial) coding errors. Each time a new QEMU release comes out, I have to recreate the patch files. Frustrating to say the least.
An old platitude says it best; Slovenly writing indulges the writer while clear writing indulges the reader.
Regards,
Kent
Quoted 7 lines · Kent Harris
Stefan,
I'm with you 100 percent. I already complained to this group a couple of months ago about the void* casting issue (and also using "private" as a structure element name as that barfs C++ as well -- there are others.)
Quoted 7 lines
For my situation, these problems within C-language source files are not an issue but when they occur inside a QEMU header file that I must include from my C++ device models, my compilations fail. Consequently, I have a whole series of patch files to the QEMU source that I have to apply to correct these (trivial) coding errors. Each time a new QEMU release comes out, I have to recreate the patch files. Frustrating to say the least.
#define private cxx_private
#include <qemu.h>
#undef private
Job done.
Signature · 2 lines
Måns Rullgård [email protected]
Quoted 7 lines · Kent Harris
Stefan,
I'm with you 100 percent. I already complained to this group a couple of months ago about the void* casting issue (and also using "private" as a structure element name as that barfs C++ as well -- there are others.)
Quoted 7 lines
For my situation, these problems within C-language source files are not an issue but when they occur inside a QEMU header file that I must include from my C++ device models, my compilations fail. Consequently, I have a whole series of patch files to the QEMU source that I have to apply to correct these (trivial) coding errors. Each time a new QEMU release comes out, I have to recreate the patch files. Frustrating to say the least.
I have a great idea. For maximum portability, lets all start writing code like this: http://ideology.com.au/polyglot/polyglot.txt That way, it will work in almost any language, and everybody will be happy.
Signature · 2 lines
Måns Rullgård [email protected]
Quoted 17 lines · M?ns Rullg?rd
Quoted 7 lines · Kent Harris
Stefan,
I'm with you 100 percent. I already complained to this group a couple of months ago about the void* casting issue (and also using "private" as a structure element name as that barfs C++ as well -- there are others.)
Quoted 7 lines
For my situation, these problems within C-language source files are not an issue but when they occur inside a QEMU header file that I must include from my C++ device models, my compilations fail. Consequently, I have a whole series of patch files to the QEMU source that I have to apply to correct these (trivial) coding errors. Each time a new QEMU release comes out, I have to recreate the patch files. Frustrating to say the least.
Quoted 3 lines
I have a great idea. For maximum portability, lets all start writing code like this: http://ideology.com.au/polyglot/polyglot.txt That way, it will work in almost any language, and everybody will be happy.
Reminds me of http://fly.srk.fer.hr/ioccc/1986/applin.c
Signature · 1 line
mailto:[email protected]