Re: FYI: C++ in the core.
From: Last2Know (grokkalot_at_yahoo.com)
Date: 10/30/04
- Next message: Roger Leigh: "Re: Framebuffer programming"
- Previous message: Floyd L. Davidson: "Re: Linux serial port programming problems"
- In reply to: Ulrich Eckhardt: "Re: FYI: C++ in the core."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 30 Oct 2004 13:11:46 -0500
On Sat, 30 Oct 2004 10:38:04 +0200, Ulrich Eckhardt wrote:
> Erik de Castro Lopo wrote:
>> Ulrich Eckhardt wrote:
>>> ... I could well imagine a restricted subset of C++ in the
>>> kernel. In particular things like destructors, namespaces and
>>> type-safety are IMHO lacking,
>>
>> The type safety of c++ is about 0.5% more than the type safety of C
>> with warnings turned on.
>
> GCC will still not warn you when a void pointer is converted to a typed
> pointer (correct me if I'm wrong, I didn't check it), because a void
> pointer in C is a generic pointer, i.e. a pointer that always fits. In C++
> it is a typeless pointer, which converts to nothing without explicit cast.
> There are uses for both types of pointers (e.g. malloc() should return a
> generic pointer, and there are ideas to add such a beast to C++), but
> handling void pointers is inherently error-prone, as it puts all checks up
> to the programmer instead of the compiler.
I'd expect that adding 'const' to the type system in the manner of C++
would be an even bigger help for kernel programming. Also stuff
like making a member variable private/protected and then being able to
easily make a substantive or debugging changes to every access
of that variable in just a few places (though the appropriate
member functions) is a big time saver.
- Next message: Roger Leigh: "Re: Framebuffer programming"
- Previous message: Floyd L. Davidson: "Re: Linux serial port programming problems"
- In reply to: Ulrich Eckhardt: "Re: FYI: C++ in the core."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|