Hi Eric
If you use the G++ compiler, you can program with C++ and avoid classes, have
efficient code and except for the canned classes (namespace std) and some
others, gain as much performance as if coding in C.
structures, unions, still work in C++.
I am not a strong C++ programmer, but if I declare a class, can I declare a
pointer of that class type and assign it to NULL or to any other object of the
same class?
Can I do a memset(class_pointer, 0, sizeof(class)); To wipe out a class with
mixed binary and asciiz string variables, some of which are public and some
protected?
Via constructors, I believe I would have to do an initialization of each class
variable, one by one.
Is there a sizeof(class name) operator? fwrite( object, number of objects,
sizeof object, file pointer0 I am just asking as my C++ books don't talk about
this.
What I do like in C++ is the extension of the C printf sprintf, fprintf
functions.
My frustrations with C. If I have error messages in English, my variables may
be in a,b,c sequence. If I switch languages, they would be in a,c,b sequence
or even c,a,b sequence. this grammer language dependent (english, french,
spanish) problems appears addressed with C++ or is it?
Related to another topic. C coding style.
When I make my pointers that are malloc()ed global (above main() ), then I have
a way for a global function exit() to free memory.
As well I can allocate memory in a sub function, retrieve the information in
the calling function, and do a free() from the caller, if I have to. If I
allocate memory in the sub-function, and forget to do a free() I leave an
orphan. But I can do something too when I call exit(nn). As all the pointers
to malloc'd areas are global, I can do some nice cleanup. (I write security
stuff, and I want to wipe out my areas before the free() or before the program
exits.) Many times when anomalies are detected in sub-functions, we issue the
longjump, code and I try to avoid this use.
C++ has the try() { stuff}, which I like.
Regards
Leslie
Mr. Leslie Satenstein
50 years in Information Technology and going strong.
Yesterday was a good day, today is a better day,
and tomorrow will be even better.
mailto:[email protected]
alternative: [email protected]
www.itbms.biz www.eclipseguard.com
--- On Fri, 8/10/12, Eric P. <[email protected]> wrote:
From: Eric P. <[email protected]>
Subject: [MLUG] C? Why yes, it is still awesome!
To: "MLUG List" <[email protected]>
Date: Friday, August 10, 2012, 5:22 PM
Hendrik wrote:
> This is exactly why C is going to stay around -- people use it because
> it is popular, and it's popular because peope use it. I couldn't have
> expressed it better myself.
This whole thread is a joke, right? C is popular?
It start off with the false claim that "C is obsolete", which was
then back pedaled into, "well, it's still okay in certain circumstances."
Add a tall cool glass of "it's unsafe", Then throw in the side order of
"it sucks but it's popular, what can you do?"
There was an interesting comment in the thread, that got ignored, that some
are worried C programmers are a growing shortage. If that's true, maybe
you'll get what I presume is your wish; that C will finally die.
Engineers use what works, despite what theorists might want in some imaginary,
unproven context. It's disingenuous to claim it's all about popularity.
My comment about "computer scientists" was in contrast to software engineers.
In my experience the former do a lot of navel gazing, the latter get stuff done.
I think the latter are also remunerated better. Most of the compsci heavy
lifting seems to have been done 4-5 decades ago, leaving plenty of time now
for the pet-language, pet-compiler projects and book writing.
Anyhow, I'm still waiting a the counter point to the fact that the largest
multi-decade, free software projects (various kernels, X) are built in C
because it's actually on merit. I mean something other than it's simply
inertia from a popularity contest.
I don't believe that simplistic argument any more than I believe it in
the context of why all the *BSDs have fallen to the wayside at the feet
of Linux.
If the kernel wasn't written in C, this whole thread wouldn't have much
business being on this list. Maybe we can move this thread over to lkml
and get the ball rolling on the rewrite.
-E
_______________________________________________
mlug mailing list
[email protected]
https://listes.koumbit.net/cgi-bin/mailman/listinfo/mlug-listserv.mlug.ca
_______________________________________________
mlug mailing list
[email protected]
https://listes.koumbit.net/cgi-bin/mailman/listinfo/mlug-listserv.mlug.ca