C (functional programming) VS C++ (object oriented programming)

C (functional programming) VS C++ (object oriented programming)

Post by Joe May » Wed, 03 Oct 2007 22:32:16


I think I become more and more alone...
Everybody tells me that C++ is better, because once a project becomes
very large, I should be happy that it has been written in C++ and not C.
I'm the only guy thinking that C is a great programming language and
that there is no need to program things object oriented.

Many people says also that they save more time by programming projects
object oriented, but I think its faster to program them in a good
structured functional way.

What do you think?

--
-= Joe Mayo* =-
* This is a fake name.
 
 
 

C (functional programming) VS C++ (object oriented programming)

Post by Mark Bluem » Wed, 03 Oct 2007 22:36:53


Try bathing occasionally...


For some value of "Everybody"...


No you should be sad that it was written in C++ not Intercal.


Really? You're the only guy thinking that? That's news to me...


I think that that you should find a group which discusses the pros and
cons of various languages... This probably isn't it.

 
 
 

C (functional programming) VS C++ (object oriented programming)

Post by Richard He » Wed, 03 Oct 2007 22:43:35

Joe Mayo said:


Well, not everybody. The people who tell you C++ is better than C fall into
two categories:

1) the ones who have never spent the time necessary to master C;
2) the ones who /have/ spent the time mastering both C and C++, and who
have discovered that C++ fits the way they think about programming better
than C does.

Conversely, the people who tell you C is better than C++ fall into two
categories:

1) the ones who have never spent the time necessary to master C++;
2) the ones who /have/ spent the time mastering both C and C++, and who
have discovered that C fits the way they think about programming better
than C++ does.

<snip>


No, you aren't.


Great! Let them. Meanwhile, feel free to save more time by programming them
the way that suits you best. If that means using C, use C.


They're programming languages, not religions.

--
Richard Heathfield < http://www.yqcomputer.com/ >
Email: -http://www. +rjh@
Google users: < http://www.yqcomputer.com/ ;
"Usenet is a strange place" - dmr 29 July 1999
 
 
 

C (functional programming) VS C++ (object oriented programming)

Post by santos » Wed, 03 Oct 2007 22:52:46


<snip>


Such a group might be comp.programming

But this particular topic has been beaten to death countless times all over
the Net. Broaching it again is only likely to start yet another flame war.
 
 
 

C (functional programming) VS C++ (object oriented programming)

Post by jacob navi » Wed, 03 Oct 2007 23:00:44

oe Mayo wrote:

Customer: Look jacob, you wrote the stuff in C!
me: Yes why?
Customer: No structure, no classes, no nothing. Besides we do
not have anybody that knows C here!

At the same time, as more and more people decide that C is hopeless,
the C++ people advance, making progress in all directions.

I still believe that a simple non object oriented language like C
has a place in software development where it offers speed and
transparency.

Central to this situation is the standards committee, that for the time
being has decided to do... well nothing until 2019 or later. Small steps
are done, they declared "gets" deprecated, and there are some very
interesting TR in the pipeline but nothing is definitely adopted
into the standard. C 2009 is dead as it seems.

And this group, with the core "regulars" is an example of people
living in the past, without even noticing or acknowledging that
data processing is evolving, that all languages must adapt or disappear.

Both GNU and Microsoft agree: C is dead. Gcc still hasn't gotten to
accept the C99 standard fully, and Microsoft ignores it. At least
Microsoft tries to participate in the standards committee, they proposed
their "safer C" extensions to the library, what is a major advance.
The GNU people do not discuss C anymore, and their compiler is a C++
compiler, where all development is done.

There are no technical reasons for this situation. It could be possible
to clean and expand the standard library, one of the most glaring
deficiencies of the language. Designed in the 70s, it hasn't changed
since then, and it shows!

No abstraction, low level, dangerous procedures like strncpy, gets,
asctime, and MANY others. It knows nothing about containers, hash
tables, stacks, linked lists. The zero terminated strings are the only
string type supported.

Making a better string library, allowing for operator overloading for
containers and new numeric types, improving the language to adapt it
to the new hardware environment available is frowned upon, "that
wouldn't be C", as if C would disappear if we put strncpy and gets
in the trash can.

I have invested the last 12 years of my life working to improve the
situation. The lcc-win32 implementation of C99 is one of the most
successful around, and in August we passed the *half million*
downloads.

The interest for C is still big, but this has been an effort
of a few people, that have invested an enormous amount of work
into that implementation.

Will it be possible to turn this tide around?

Can a simple language like C exist?

Yes, of course. It needs a rewrite of the standard library, and
some syntactic sugar to accommodate containers, lists, stacks, and other
data structures into a standard library that could be much simpler
to use than the STL, but much more efficient and adapted to
smaller memory footprints.

This could be done with the extensions I have proposed here (and
in comp.std.c). They can be reviewed here:

http://www.q-software-solutions.de/~jacob/proposal.pdf

jacob


--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
 
 
 

C (functional programming) VS C++ (object oriented programming)

Post by jacob navi » Wed, 03 Oct 2007 23:05:43


You are the typical example of many people here:

Arrogant and prone to verbal *** without any justification:

> Try bathing occasionally...

Ahhh how comic!

> I think that that you should find a group which discusses the pros and
> cons of various languages... This probably isn't it.

Of course not!

This group doesn't discuss C. It is just for people like you that
get their "kicks" by insulting others, being *** , and just ignoring
the issues the OP raised!

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.yqcomputer.com/ . *** ia.edu/~lcc-win32
 
 
 

C (functional programming) VS C++ (object oriented programming)

Post by John Bod » Wed, 03 Oct 2007 23:09:46


I think you need to look up the definition of functional programming,
because C is *not* a functional programming language. Haskell and ML
are functional languages.

Both procedural and object-oriented techniques (as well as functional
techniques) have their strengths and weaknesses. IME some solutions
are easier to visualize and express in terms of objects rather than
procedures (concurrency is one area where I think an object-oriented
approach is much cleaner and easier to understand).

I've been working with C++ for several years now, and there are a lot
of areas where I prefer it to C (string handling alone is orders of
magnitude less frustrating in C++). But there are times when I don't
need the overhead, and a straight C solution will work just as well.

Here are some lessons I've learned over the years, FWIW:

1. There are no magic bullets
2. All programming languages suck
3. It's always in your best interest to learn and explore as many
different programming languages as you can, because one size does
*not* fit all.
 
 
 

C (functional programming) VS C++ (object oriented programming)

Post by jacob navi » Wed, 03 Oct 2007 23:29:05


Important clarification. C is just structured programming, not
"functional" programming.


Yes, this is true. Hence my efforts to improve this part of C. But
many people here believe that the only possible string type is just
those zero terminated buffers!



Exactly. And C could be the language that fills those needs, if
it had a slightly better run time and syntax.


I agree with that.


--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.yqcomputer.com/ . *** ia.edu/~lcc-win32
 
 
 

C (functional programming) VS C++ (object oriented programming)

Post by Mark Bluem » Wed, 03 Oct 2007 23:31:50


[Snip]

Some degree of arrogance, I'm prepared to own up to, I suppose.

"Prone to verbal *** "? I'm not sure my record is that bad.


It amused me at the time. You are welcome to ignore or killfile me if my
postings consistently offend you.


Some of us try to... In this case I didn't and still don't see any
value in a "C vs C++" debate in this newgroup...

However, my last sentence in the paragraph you quoted deliberately left
room (by the use of the word "probably") for others who feel differently.


I don't think that in general my postings in this group are about
insulting people or being *** . If I have given that impression, I'm
rather disappointed.

However, I do reserve the option of having an occasional jibe at someone
who I feel deserves it...

In this case, someone using an avowed false name posted something that
looks like provoking an unprofitable exchange of hot air.


What issues did he raise? Nothing solid enough to really discuss. Just a
startpoint for airing prejudices.
 
 
 

C (functional programming) VS C++ (object oriented programming)

Post by jacob navi » Wed, 03 Oct 2007 23:38:28


And maybe looking earnestly into the C library and thinking a bit:

"Maybe we should reconsider this stuff" ???

Never occurred to you that many critiques of C are completely justified
and we should address those?

There is no point in "hot air" discussions but an earnest analysis
of the faults in the library would be a better starting point.

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.yqcomputer.com/ . *** ia.edu/~lcc-win32
 
 
 

C (functional programming) VS C++ (object oriented programming)

Post by Richard He » Wed, 03 Oct 2007 23:48:56

Mark Bluemel said:




Hubris is one of the first three essential characteristics of a programmer.
The other two in the first three are impatience and laziness. (The *other*
three are, of course, humility, patience, and diligence.)


It isn't. Please bear in mind that your interlocutor is someone who
frequently misunderstands the simplest points, frequently takes offence,
frequently construes criticism as a personal attack, frequently mocks what
he does not understand, and frequently accuses people of lying, apparently
because he doesn't comprehend what they're actually talking about.

So if I were you I wouldn't pay too much attention.


Nor do I. It's not a competition.


That is not the impression I've got from your articles.

<snip>

--
Richard Heathfield < http://www.yqcomputer.com/ >
Email: -http://www. +rjh@
Google users: < http://www.yqcomputer.com/ ;
"Usenet is a strange place" - dmr 29 July 1999
 
 
 

C (functional programming) VS C++ (object oriented programming)

Post by santos » Wed, 03 Oct 2007 23:55:24

acob navia wrote:


<snip>


Why don't you join your national body for C Standardisation instead of
complaining endlessly in this group?


I'd wager that most of the "regulars" here maintain successfull careers and
fully understand C's relative importance in the field of s/w engineering.
However that doesn't imply that the group's de facto topicality rules,
which have served it well, can be thrown out of the window.


For Microsoft, maybe. But surely gcc's C compiler is still used in a variety
of environments where C is a main implementation language. C isn't dead;
it's use on the most user visible platform of computing, i.e. the desktop,
has reduced, but it's very much used elsewhere.


That doesn't imply C is dead, just that it's latest Standard is rather
unpractical.


C is not, and can never be, a "safe" language like Java or C#/.NET. If you
want a "safe" language, you can use one of them.

C was designed to be effectively used by those who take the time and effort
to understand it's design choices and their ramifications.


This is most likely untrue. You are engaging in polemic.


Most platform already have suitable and Standardised, (not C Standard),
alternatives to many Standard C functions.


Any software project worth it's name has in-house procedures that spell out
these problems and propose recommended alternatives. As has been explained
to you on countless occasions, the Standard cannot change the semantics or
remove these functions because doing so would break huge amounts of
existing code.


All of these are, in most situations, already available in the form of
preexisting libraries. The GNU GLib is an example.


Alternative string packages abound.


Yes, if you exceed a certain threshold for modifications to the language,
there will come a time when calling it C would become misleading and
disingenuous. Your lcc-win32 language is heading in that direction.

<snip>


On your platforms of choice, I don't think so.


It not only exists, but thrives and will continue to exist even if maybe not
where _you_ want it to.

But as you yourself noted, one shouldn't fear change. If the vast majority
of desktop programmers deem C impractical, why would you cling to the past
and ignore reality?


As I said before, there are already workarounds and prebuilt libraries to do
much of what you propose wiring into the language and taking it down the
rocky road that C++ has already travelled.


Thanks, I'll take a look.

 
 
 

C (functional programming) VS C++ (object oriented programming)

Post by Christophe » Thu, 04 Oct 2007 00:14:22


comp.lang.c.advocacy anyone? I'm in favor of anything that increases
the liklihood that these "c is dead" threads will end up somewhere
else.


It's probably topical on alt.dead.horses.

--
C. Benson Manica | I appreciate all corrections, polite or otherwise.
cbmanica(at)gmail.com |
----------------------| I do not currently read any posts posted through
sdf.lonestar.org | Google groups, due to rampant unchecked spam.
 
 
 

C (functional programming) VS C++ (object oriented programming)

Post by Richar » Thu, 04 Oct 2007 00:24:17

santosh < XXXX@XXXXX.COM > writes:




Look. It may or may not have served it well. All I know is that it is
one of the rudest technical groups I have ever come across and that a
little more leeway and thought before sneering and saying "off topic" is
required. The example I have about the inclusion of mstat.h is a good
example. People come here in good faith to get help programming C. If
you can help, help. Most issues stay in the same threads. Dont like it?
Kill the thread. Clearly, as Chris Hills says, if there IS indeed a more
suitable groups where there are actually resident experts then that
thread will indeed move there.
 
 
 

C (functional programming) VS C++ (object oriented programming)

Post by jacob navi » Thu, 04 Oct 2007 00:50:54

antosh wrote:

This means that interfaces like strncpy of gets or asctime are OK?

I mean nobody is saying that we should eliminate pointers (as Java does)
but is it necessary to keep every wart in the
language forever?

This attitude of

"C is so dangerous anyway that it is better to leave it die a peaceful
death"

leads to the death of C as a programming language. Yes, it will survive
a few years in small circuit boards but then, even those will disappear.


Yeah the elite...
:-)


o GNU doesn't participate in any discussion or standards
committee about improving C or is a part of the standardization
effort as far as I can see. Their compiler doesn't introduce anything
new or innovative for C since several years. Yes, they were innovative
at the beginning, in the 90s. But then they have all their hands
full with C++ and stopped any C development.


And why couldn't we standardize them in the language then?


This is bogus and you know it. It suffices to give the new functions
a slightly different name!


All of those libraries are not standard, then the user is burdened with
learning each one of them in each platform!

If C had a standard interface for lists, stacks, etc, the programmers
could choose from different implementations offering the same interface!

Programs would be much more portable!



Same as above.


typedef struct tagString { size_t length; char *data; } String;

This is NOT C. Calling this C would be disingenious.


--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32