[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54083C0F.1040807@ahsoftware.de>
Date: Thu, 04 Sep 2014 12:16:47 +0200
From: Alexander Holler <holler@...oftware.de>
To: Peter Zijlstra <peterz@...radead.org>
CC: Borislav Petkov <bp@...en8.de>,
Måns Rullgård <mans@...sr.com>,
Steven Rostedt <rostedt@...dmis.org>,
Christopher Barry <christopher.r.barry@...il.com>,
linux-kernel@...r.kernel.org
Subject: Re: OT: Open letter to the Linux World
Am 04.09.2014 09:54, schrieb Peter Zijlstra:
> On Mon, Aug 18, 2014 at 08:15:45PM +0200, Alexander Holler wrote:
>>
>> Hmm, a sane and maintainable solution would use C++ with which people don't
>> have to manually build lists or hashes for every structure like in the
>> kernel (generic programming done right). So you won't find much kernel
>> developers there. ;)
>>
>
> Troll a lot do you? ;-)
Not really.
I just hate all the stuff which is necessary in C when I e.g. want a
sorted list, map or set for whatever structure I have the need for. I
had fun doing so 30 years ago, when I started to learn C, but now it's
just tiring.
E.g. for the dependency based initialization order with DT I would have
liked it to have a list (or map or set) of strings (sorted) in order to
find a driver by name (fast). In C++ it would need something < 10 lines
of source and I would be able to change the sorting algorithm from list
to map(hash) or similiar by changing a few lines. Doing so in C is just
a pain. Not to speak about all the possible errors when implementing the
stuff in C again and again. Ok, the kernel provides some macros for
lists, but e.g. they can be found only in the kernel (which means many
people don't know or remember how to use them) and are by far not that
flexible.
> While I like C++ (and quite a number of kernel people can in fact write
> C++ no problem) we can have a long debate about whether the STL is in
> fact 'done right' :-)
Up to now I haven't seen something really better. Of course, there are a
lot of other programming languages which do make it easy to use lists,
maps and similiar, but none of them is as fast and portable as C++ while
still allowing to do low-level things (if necessary).
> Also, I don't think init (as in PID-1) should be a large program, and
> therefore writing it in C would be entirely reasonable.
It's a myth that C++ ends up in bigger code than C. At least in my
experience. Especially when the latest additions to C++ are in effect
(like the move-semantics in C++11 I like quiet a lot and which you get
almost for free (by changing nothing) when you use the STL). Thread
support is now also standardized (in C++11), quiet nice to use.
Regards,
Alexander Holler
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists