Masood said:
I know that this topic may inflame the "C language Taleban", but is
there any prospect of some of the neat features of C++ getting
incorporated in C? No I am not talking out the OO stuff. I am talking
about the non-OO stuff, that seems to be handled much more elegantly in
C++, as compared to C. For example new & delete, references, consts,
declaring variables just before use etc.
I am asking this question with a vested interest. I would really like
to use these features in my C programs.
Only two of these seem to be of much use in C. Declarations
mixed with statements are already allowed by the C99 Standard, so
your wish is granted. The semantics of `const' (meaning "read-
only" rather than "compile-time constant") seem unlikely to change
at this point, so you probably don't get that one -- but plain C
offers alternatives that may suffice for many situations.
I find it hard to imagine how new and delete can be of much
benefit without constructors and destructors to go along with
them. All they could do is reserve and release memory, and C
already has mechanisms (plural) to do that. If you want to drag
in constructors and destructors to make new and delete useful,
I think you're bringing in too much of "the OO stuff" that you
intended to avoid.
References -- well, I'm not a C++ programmer and do not claim
to understand references fully. When I want a function to change
something the caller supplies to it, I use a pointer and all is
well. What do you want to accomplish that pointers can't handle?
Finally, you might want to avoid inflammatory epithets if
you want serious consideration of your ideas and proposals. True,
a few contributors to this forum habitually lard their arguments
with explicit assumptions that all opponents are fools and morons,
but you might take a lesson from the notable lack of success such
arguments have met. Make your arguments on their merits, because
they'll be rejected out of hand if you make them on their demerits.