Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Oct 2007 23:19:50 +0100
From:      "Ivan Voras" <ivoras@freebsd.org>
To:        "Poul-Henning Kamp" <phk@phk.freebsd.dk>
Cc:        freebsd-arch@freebsd.org
Subject:   Re: C++ in the kernel
Message-ID:  <9bbcef730710301519p2931006aq5ba3a94fa1cc67c5@mail.gmail.com>
In-Reply-To: <2979.1193779624@critter.freebsd.dk>
References:  <9bbcef730710300648s4a4162a9x25e5a092111eaab9@mail.gmail.com> <2979.1193779624@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
On 30/10/2007, Poul-Henning Kamp <phk@phk.freebsd.dk> wrote:
> In message <9bbcef730710300648s4a4162a9x25e5a092111eaab9@mail.gmail.com>, "Ivan
>  Voras" writes:
> >I think the context of my quote was in favour of this, as long as the
> >language remains standard.
>
> But then again, what exactly is "standard" in this context ?
>
> C99 ? or style(9) ?
>
> We already use a C-diallect, all I'm proposing is giving it more
> theeth so it can help us.

Maybe I can better explain my thoughts and what I mean by "ugly" by
giving an example. This:

SLIST_FOREACH(a,b,c) {
}

is ugly (one of the reasons is that you need to pass the linkage field
name all the time). This:

for x in list {
}

is not. (Yes, the last one looks like a bastard offspring of C and
Python, but it's a coincidence). Tree macros are worse, among other
things for the fact that you constantly need to pass the type name as
an argument. I'm not trying to insult the authors and users of these
macros - they are both convenient and powerful, but you can only go so
far with macros and preprocessor magic before the whole things starts
to sprout mental spikes.

I.e. I'd like something like that to be done right - if a different
language is really needed, than accept a different language (not
butcher C into obedience) as long as it's well defined and used by
more than a dozen people on the Earth.

Re: C++: This:

for (vector<int>::iterator it = v.begin(); it != v.end(); ++it)

still looks pretty ugly but at least it's known to almost any CS/IT
undergrad out there.

My personal choice of a "C++ done right" language is D, it has this variant:

foreach(i, a; args)
    writefln("args[%d] = '%s'", i, a);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9bbcef730710301519p2931006aq5ba3a94fa1cc67c5>