Daniel Phillips <news-innominate.list.linux.kernel@innominate.de> said:
[...]
> Well, I *like* using // for one line comments, and I *hate* having my
> code obfuscated with extra declaration lines just because I can't
> declare something in the middle of a block.
Those are rather weak reasons for selecting one language over the other.
> There is no reason whatever
> to hang on to such stupid limitations in C in the mistaken belief that
> it somehow keeps it more pure.
If I'm not mistaken, both are in C99 (yes, gcc doesn't comply yet). No huge
outcry I've heard... OTOH, it is (sadly) true that people bicker bitterly
over trivial aspects of their choosen languages (i.e., comment format, or
where you can declare new stuff) and never even consider the areas of
_real_ differences.
> On the other hand, I hate bloat even
> more than I hate those other two things.
At least a step forward.
> On the third hand, the first
> feature is already in every known C compiler
// comments are in gcc; definitions wherever you like aren't.
> (but you will be pecked to
> death by a flock of penguins if you use it) and the second feature
> actually represents a simplification of the compiler code,
It gets more complicated to do one-pass compilation, as you have to collect
the definitions that affect the current frame by looking at the whole block
first. True, the difference is trivial or nonexistent with current compiler
technology, but it was important in K&R days.
> which in case
> anyone doesn't know uses the same code generator and most of the same
> parser whether you write in C or C++ - so I don't know where all those
> arguments about relative efficiency of generated code are coming from.
The parsers for C and C++ in gcc are completely different. C and C++ happen
to look alike as long as you don't stray from the C subset of C++ (no
wonder, C++ was designed that way), but the full languages are utterly
different. C is rather easy to parse, C++ is a nightmare. Sure, if I'd have
to start writing a C/C++ compiler today, I'd think of arranging for a
common parser just to save some work.
> The way to get C++ into the kernel is to get some of the less invasive
> features of C++ into C. This process started a long time ago and will
> never stop. Gosh, even if you are a C++ hater you are probably already
> using a bagfull of C++ features.
It's called ANSI C, aka C89 (const, prototypes, void *), and now C99. But
is goes the other way much more, and OO-people hate C++'s guts because of
what it inherited from C ;-)
-- Dr. Horst H. von Brand mailto:vonbrand@inf.utfsm.cl Departamento de Informatica Fono: +56 32 654431 Universidad Tecnica Federico Santa Maria +56 32 654239 Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sat Sep 30 2000 - 21:00:22 EST