"cr88192" <cr88192@[EMAIL PROTECTED]
> wrote in message
news:51475$481ff7ff$ca83b482$3400@[EMAIL PROTECTED]
>
> "Chris Thomasson" <cristom@[EMAIL PROTECTED]
> wrote in message
> news:_eadnWL1xbc8EILVnZ2dnUVZ_j2dnZ2d@[EMAIL PROTECTED]
>> "Raz" <osjdf@[EMAIL PROTECTED]
> wrote in message
>> news:715v141f46a5eg638h45f6tu2pem1hohh1@[EMAIL PROTECTED]
>>>
>>> On Wed, 30 Apr 2008 21:54:37 GMT, Erik Wikströ
>>>
>>>>Obviously his knowledge of C++ is not as good as it should be.
>>>
>>> As I said, I will find the link again. His knowledge of C++ is just
>>> fine.
>>>
>>>
http://www.builderau.com.au/video/soa/Rusty-s-message-to-C-programmers/0,2000064338,22432924p,00.htm
>>>
>>>
http://www.builderau.com.au/video/soa/Why-C-remains-relevant/0,2000064338,22432921p,00.htm
>>>
>>> So here is an expert of who believes that you don't need C++ to
>>> program low level. C++ brings extra complexity that is not needed.
>>
>> [...]
>>
>> You are not forced to use "all" the features of C++. One could most
>> certainly use C++ in a kernel. However, I personally would avoid
>> exceptions and global ctor/dtors like the plague. I also would not use
>> the STL, oh well...
>
> one has to give up many of the features, and is still faced with many of
> the other technical issues, that IMO one is better off just using C...
Use all POD's, no ctor/dtor/"AUTO-vtable":
struct [kobject_name_POD] {
[state];
void ctor() {
}
void dtor() throw() {
}
[kobject_name_POD_API];
};
Think in terms of:
http://groups.google.com/group/comp.lang.c/browse_frm/thread/1b106926ba5db19f
convert that C code into simple C++ interface... POD and ASM can be used
in
a Kernel.
Use only explicit C++ POD, __NO__ STL, exceptions, constructor,
destructors,
virtual functions, inheritance, whatever... Every object is POD; ctor/dtor
is explicit. POD templates would be allowed. You can still benefit from
the
syntax of the language - kernel unfriendly features.
Each POD can be initalized like:
struct Kernel_atomic_word {
atomic_word m_value;
#define KERNEL_ATOMIC_WORD_STATICINIT(mp_value) { \
(mp_value) \
}
void ctor(atomic_word const value) {
m_value = value;
}
void dtor() throw() {}
// fetch-and-add
atomic_word faa_mbacq(atomic_word const addend) throw() {
atomic_word const result = ATOMIC_FAA(&m_value, addend);
MEMBAR_ACQUIRE();
return result;
}
atomic_word faa_mbrel(atomic_word const addend) throw() {
MEMBAR_RELEASE();
return ATOMIC_FAA(&m_value, addend);
}
// swap
atomic_word swp_mbacq(atomic_word const value) throw() {
atomic_word const result = ATOMIC_SWP(&m_value, addend);
MEMBAR_ACQUIRE();
return result;
}
atomic_word swp_mbrel(atomic_word const value) throw() {
MEMBAR_RELEASE();
return ATOMIC_SWP(&m_value, addend);
}
};
Of course, C is nice... See, you can do "crude" OOP in C:'
http://groups.google.com/group/comp.lang.c/browse_frm/thread/1b106926ba5db19f
;^)
Humm, well, it every abstract interface has a vtable, yet their all POD...
Humm... Could possibly useful in a Kernel environment.
Indeed...
One can use C/C++ syntax in
(POD+someASM+OOP)-(exceptions+ctor/dtor+virtual_func) in a Kernel...


|