Re: Is C99 the final C?
From: David M. Wilson (dw-google.com_at_botanicus.net)
Date: 12/01/03
- Next message: CBFalconer: "Re: scanf() vs gets()"
- Previous message: Irrwahn Grausewitz: "Re: File Viewer that stops at the 24th line"
- Maybe in reply to: CBFalconer: "Re: Is C99 the final C?"
- Next in thread: glen herrmannsfeldt: "Re: Is C99 the final C?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Nov 2003 16:21:54 -0800
Hi Michael!
"Michael B." <usemike@spamblocked.com> wrote in message...
> Of course, I speak only of features in the spirit of C; something like
> object-orientation, though a nice feature, does not belong in C.
> Something like being able to #define a #define would be very handy,
> though, e.g:
>
> #define DECLARE_FOO(bar) #define FOO_bar_SOMETHING \
> #define FOO_bar_SOMETHING_ELSE
Although this is my opinion, I think a lot of people would agree:
preprocessor magic should be kept simple and to a minimum. Although
some wonderful tricks can be accomplished using the current
preprocessor syntax (and indeed, your proposed extension), it quickly
becomes a maintenance and readability nightmare - for the coder who
originally wrote it, or for someone else who is picking up the code.
For large #if #else #endifs around platform-specific code, usually
there is a nicer solution found in abstracting said code, and writing
per-platform translation units which are then linked in by your build
system.
> I'm not sure whether the features of cpp are even included in the C
> standard
They are.
> I would also like to see something along the lines of C++ templating,
> except without the really kludgy implementation that the C++ folks decided
> to go to ( and without the OOP ).
I'd imagine that adding a new fundamental concept such as this to the
C standard stands as good a chance at getting approval as a snowball's
chance of not melting in hell. :)
C is a very simple and uniform language - possibly a major reason for
the roaring success it has had over the years. It is also very
explicit - usually a statement does exactly what it says it does
(unless it includes a cpp macro ;). Concepts such as templates,
although useful, detract from the overall simplicity of the language.
> Templates save a lot of time when it comes to commonly-used data
> structures, and as they are entirely implemented at compile-time and don't
> include, by their definition, OOP (although they can be well suited to
> it), I think they would be a nice addition and in the spirit of C.
I would almost say that C already supports 'templates' for structures
at least. For example, imagine:
struct list_head {
struct list_head *next, *prev;
};
struct my_list_type {
struct list_head list_head;
void *my_data;
};
struct my_list_type ml;
As far as I can tell, accessing ml.list_head.next is just as quick
(after compilation) as accessing ml.next, assuming that 'ml.next' is
part of a structure that was generated using a template facility.
This example actually comes from a real project - namely the Linux
kernel. Lots of other people use it too. You could consider it a
'cultural standard idiom'. :)
Yes, coining a stupid phrase like that was completely unneccesary. :D
> Your thoughts? I'm sure there's some vitriol coming my way but I'm
> prepared 8)
C is simple. It has stood the test of time, and thus "if it ain't
broke, don't fix it".
I believe that C is on it's way out as a general use tool. Sure, it
probably has 20 years left, but programming ideologies are evolving,
and computing is moving to new heights.
C has found it's niche market in lower level and high performing
applications, it is relatively expressive, and it generates small,
tight code. That market isn't about to change, and neither (I believe)
is C. Let's leave it be until the dog has its day, and finally goes to
sleep.
C is dead! Long live QuantumC! ;)
David.
- Next message: CBFalconer: "Re: scanf() vs gets()"
- Previous message: Irrwahn Grausewitz: "Re: File Viewer that stops at the 24th line"
- Maybe in reply to: CBFalconer: "Re: Is C99 the final C?"
- Next in thread: glen herrmannsfeldt: "Re: Is C99 the final C?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|