By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,401 Members | 793 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,401 IT Pros & Developers. It's quick & easy.

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

P: n/a
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.
Oct 2 '07 #1
Share this Question
Share on Google+
139 Replies


P: n/a
Joe Mayo wrote:
I think I become more and more alone...
Try bathing occasionally...
Everybody tells me that C++ is better,
For some value of "Everybody"...
because once a project becomes
very large, I should be happy that it has been written in C++ and not C.
No you should be sad that it was written in C++ not Intercal.
I'm the only guy thinking that C is a great programming language and
that there is no need to program things object oriented.
Really? You're the only guy thinking that? That's news to me...
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?
I think that that you should find a group which discusses the pros and
cons of various languages... This probably isn't it.
Oct 2 '07 #2

P: n/a
Joe Mayo said:
I think I become more and more alone...
Everybody tells me that C++ is better,
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>
I'm the only guy thinking that C is a great programming language and
that there is no need to program things object oriented.
No, you aren't.
Many people says also that they save more time by programming projects
object oriented,
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.
What do you think?
They're programming languages, not religions.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Oct 2 '07 #3

P: n/a
Mark Bluemel wrote:
Joe Mayo wrote:
<snip>
>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?

I think that that you should find a group which discusses the pros and
cons of various languages... This probably isn't it.
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.
Oct 2 '07 #4

P: n/a
Joe Mayo wrote:
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?
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
Oct 2 '07 #5

P: n/a
Mark Bluemel wrote:
Joe Mayo wrote:
>I think I become more and more alone...

Try bathing occasionally...
>Everybody tells me that C++ is better,

For some value of "Everybody"...
>because once a project becomes very large, I should be happy that it
has been written in C++ and not C.

No you should be sad that it was written in C++ not Intercal.
>I'm the only guy thinking that C is a great programming language and
that there is no need to program things object oriented.

Really? You're the only guy thinking that? That's news to me...
>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?

I think that that you should find a group which discusses the pros and
cons of various languages... This probably isn't it.
You are the typical example of many people here:

Arrogant and prone to verbal violence 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 nasty, and just ignoring
the issues the OP raised!

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Oct 2 '07 #6

P: n/a
jacob navia wrote:
Mark Bluemel wrote:
[Snip]
You are the typical example of many people here:

Arrogant and prone to verbal violence without any justification:
Some degree of arrogance, I'm prepared to own up to, I suppose.

"Prone to verbal violence"? I'm not sure my record is that bad.
Try bathing occasionally...

Ahhh how comic!
It amused me at the time. You are welcome to ignore or killfile me if my
postings consistently offend you.
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.
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.
It is just for people like you that
get their "kicks" by insulting others, being nasty,
I don't think that in general my postings in this group are about
insulting people or being nasty. 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.
and just ignoring
the issues the OP raised!
What issues did he raise? Nothing solid enough to really discuss. Just a
startpoint for airing prejudices.
Oct 2 '07 #7

P: n/a
Mark Bluemel wrote:
>
What issues did he raise? Nothing solid enough to really discuss. Just a
startpoint for airing prejudices.
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.cs.virginia.edu/~lcc-win32
Oct 2 '07 #8

P: n/a
jacob navia wrote:
Joe Mayo wrote:
>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?
<snip>
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.
Why don't you join your national body for C Standardisation instead of
complaining endlessly in this group?
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.
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.
Both GNU and Microsoft agree: C is dead.
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.
Gcc still hasn't gotten to
accept the C99 standard fully, and Microsoft ignores it.
That doesn't imply C is dead, just that it's latest Standard is rather
unpractical.
At least
Microsoft tries to participate in the standards committee, they proposed
their "safer C" extensions to the library, what is a major advance.
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.
The GNU people do not discuss C anymore, and their compiler is a C++
compiler, where all development is done.
This is most likely untrue. You are engaging in polemic.
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!
Most platform already have suitable and Standardised, (not C Standard),
alternatives to many Standard C functions.
No abstraction, low level, dangerous procedures like strncpy, gets,
asctime, and MANY others.
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.
It knows nothing about containers, hash
tables, stacks, linked lists.
All of these are, in most situations, already available in the form of
preexisting libraries. The GNU GLib is an example.
The zero terminated strings are the only
string type supported.
Alternative string packages abound.
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.
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>
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?
On your platforms of choice, I don't think so.
Can a simple language like C exist?
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?
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.
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.
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
Thanks, I'll take a look.

Oct 2 '07 #9

P: n/a
[comp.lang.c] santosh <sa*********@gmail.comwrote:
Such a group might be comp.programming
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.
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.
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.
Oct 2 '07 #10

P: n/a
santosh <sa*********@gmail.comwrites:
jacob navia wrote:
>Joe Mayo wrote:
>>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?

<snip>
>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.

Why don't you join your national body for C Standardisation instead of
complaining endlessly in this group?
>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.

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.
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.
Oct 2 '07 #11

P: n/a
Richard Heathfield <rj*@see.sig.invalidwrites:
>
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.
How about
1) have spend much time on "real" OO languages
2) have found that's C++ not that OO-is
3) do dislike decisions done in C++ (virtual vs. non virtual
functions)
4) tried other OO languages not in the mainstream
5) found them more promising
6) used them but simply realized that they change too fast and need
extra work with every new release
7) appriciates that there do exist C libraries which work since
decades
8) has decided for himself that if OO and C then the way should be
Objective C ;-)

>
<snip>
>I'm the only guy thinking that C is a great programming language and
that there is no need to program things object oriented.

No, you aren't.
Depends really. Sometimes I have the feeling that OO is a good
choice. Sometimes I think it's poor choice.
>
>Many people says also that they save more time by programming projects
object oriented,

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.
I really would like to see any serious comparison on
1) let's say GTK vs QT (or something similiar)
2) C and C++
3) C and C++ and Smalltalk
4) C and C++ and other languages (bee it statically typed like
Haskell, Ocaml etc,
or dynamically typed like most of the scripting languages.)
5) C + scripting language vs whatever
Then in the end the question still is open how much time is really
spend on the implementation and how much time on maintenance later or
work before implementation.
>
>What do you think?

They're programming languages, not religions.
I feel they are a bit too believing...

Regards
Friedrich
--
Please remove just-for-news- to reply via e-mail.
Oct 2 '07 #12

P: n/a
santosh said:
jacob navia wrote:
<snip>
>This means that interfaces like strncpy of gets or asctime are OK?

Of course not.
The asctime function seems rather pointless to me, and gets is of course
unusable. But what is your objection to strncpy?

<snip>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Oct 2 '07 #13

P: n/a
jacob navia wrote:
[...]
You are the typical example of many people here:

Arrogant and prone to verbal violence 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 nasty, and just ignoring
the issues the OP raised!

Consider the above subjected to the analysis Jacod presents. We find
that Jacob's post shows arrogance. We find that it is "prone to verbal
violence without any justification". We find that this post has no
discussion of C. Many of Jacob's posts have no discussion of C, but
are, like this one, insulting and nasty. Amazingly, we find that
Jacob's post completely ignores "the issues the OP raised!"

Here's a clue, Jacob. Not everyone here is you. That you are arrogant,
insulting, prone to verbal violence without justification, nasty, and
ignore the issues the OP raised does not mean that is true of the rest
of us. I have rarely seen such an exercise in self-criticism disguised
as an attack for others.

Not all of us are as antisocial as you, Jacob. Accept it.
Oct 2 '07 #14

P: n/a
Richard Heathfield wrote:
santosh said:
>jacob navia wrote:

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

Of course not.

The asctime function seems rather pointless to me, and gets is of course
unusable. But what is your objection to strncpy?

<snip>
Nothing. I should probably not have lumped it with the likes of gets.
However I have rarely found a use for it. In most cases I use plain strcpy,
and when required an implementation of strlcpy that I wrote myself.

Mostly I feel dodgy about using a string function that can sometimes fail to
produce a valid null-terminated string.

Oct 2 '07 #15

P: n/a
santosh said:
Richard Heathfield wrote:
<snip>
>But what is your objection to strncpy?

Nothing. I should probably not have lumped it with the likes of gets.
However I have rarely found a use for it.
Likewise. Nevertheless, just occasionally it is le mot juste.
In most cases I use plain
strcpy, and when required an implementation of strlcpy that I wrote
myself.
I have never used strlcpy. I do use strcpy on occasion, but mostly I use my
own dynamic string library, for what I hope are obvious reasons.
Mostly I feel dodgy about using a string function that can sometimes fail
to produce a valid null-terminated string.
Quite. Nevertheless, it does a reasonable job of substring handling on
occasion.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Oct 2 '07 #16

P: n/a
On 2 oct, 18:13, Friedrich Dominicus <just-for-news-fr...@q-software-
solutions.dewrote:
Richard Heathfield <r...@see.sig.invalidwrites:
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.

How about
1) have spend much time on "real" OO languages
2) have found that's C++ not that OO-is
3) do dislike decisions done in C++ (virtual vs. non virtual
functions)
4) tried other OO languages not in the mainstream
5) found them more promising
6) used them but simply realized that they change too fast and need
extra work with every new release
7) appriciates that there do exist C libraries which work since
decades
8) has decided for himself that if OO and C then the way should be
Objective C ;-)
If OO and C is the right way, then I would use the C Object System
since it highlights that C is the next step after Objective-C ;-)
I really would like to see any serious comparison on
1) let's say GTK vs QT (or something similiar)
2) C and C++
3) C and C++ and Smalltalk
4) C and C++ and other languages (bee it statically typed like
Haskell, Ocaml etc,
C++ vs Haskell can be found in:

- DSL Implementation in MetaOCaml, Template Haskell, and C++
- A Comparative Study of Language Support for Generic Programming
or dynamically typed like most of the scripting languages.)
5) C + scripting language vs whatever

Then in the end the question still is open how much time is really
spend on the implementation and how much time on maintenance later or
work before implementation.
a+, ld.

Oct 2 '07 #17

P: n/a
Richard Heathfield <rj*@see.sig.invalidwrites:
santosh said:
>jacob navia wrote:

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

Of course not.

The asctime function seems rather pointless to me, and gets is of course
unusable. But what is your objection to strncpy?
There is occasionally a good reason to use strncpy(). However:

* Using strncpy() into a large buffer can be very inefficient.
strncpy() always writes to every byte in the destination
buffer, which can waste a lot of time if the destination
buffer is much longer than the source string.

* If the source string is longer than the size of the
destination buffer, then strncpy() doesn't write a
terminating null. So a call to strncpy() must be followed
by explicitly writing a null terminator at the end of the
destination buffer in most cases.
--
char a[]="\n .CJacehknorstu";int putchar(int);int main(void){unsigned long b[]
={0x67dffdff,0x9aa9aa6a,0xa77ffda9,0x7da6aa6a,0xa6 7f6aaa,0xaa9aa9f6,0x11f6},*p
=b,i=24;for(;p+=!*p;*p/=4)switch(0[p]&3)case 0:{return 0;for(p--;i--;i--)case+
2:{i++;if(i)break;else default:continue;if(0)case 1:putchar(a[i&15]);break;}}}
Oct 2 '07 #18

P: n/a
Martin Ambuhl <ma*****@earthlink.netwrites:
jacob navia wrote:
[...]
>You are the typical example of many people here:

Arrogant and prone to verbal violence 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 nasty, and just ignoring
the issues the OP raised!


Consider the above subjected to the analysis Jacod presents. We find
that Jacob's post shows arrogance. We find that it is "prone to
verbal violence without any justification". We find that this post
has no discussion of C. Many of Jacob's posts have no discussion of
C, but are, like this one, insulting and nasty. Amazingly, we find
that Jacob's post completely ignores "the issues the OP raised!"

Here's a clue, Jacob. Not everyone here is you. That you are
arrogant, insulting, prone to verbal violence without justification,
nasty, and ignore the issues the OP raised does not mean that is true
of the rest of us. I have rarely seen such an exercise in
self-criticism disguised as an attack for others.

Not all of us are as antisocial as you, Jacob. Accept it.
You have to be joking? I hate to tell you, but because Jacob disagrees
with you and some similar to you, it does not make him "nasty" in any
way whatsoever. I don't think there is a nicer poster in this
group. This type of thread didn't appear because of the wonderful job
you are doing - quite the opposite in fact. It raises its ugly head time
and time again. A core few make this news group a very unpleasant and
arrogant place. You know you they are. There are ways of correcting and
guiding people. And racing in to be first with "OT" is not one of them.
Oct 2 '07 #19

P: n/a
Richard said:
Martin Ambuhl <ma*****@earthlink.netwrites:
<snip>
>Not all of us are as antisocial as you, Jacob. Accept it.

You have to be joking? I hate to tell you, but because Jacob disagrees
with you and some similar to you, it does not make him "nasty" in any
way whatsoever.
You're right, it doesn't. What makes Mr Navia's articles nasty is not the
fact that he disagrees with others - for lots of us here disagree with
each other, and yet we manage not to be nasty. No, his articles are nasty
because he injects nastiness into them. Martin hit the nail on the head.
I don't think there is a nicer poster in this group.
That is not the only way in which you are in a tiny minority here. Mr Navia
habitually strikes out at people rather than trying to understand what
they're telling him. If that is what you regard as "nicer" behaviour, then
that's up to you, but you will find few who agree with you.

<snip>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Oct 2 '07 #20

P: n/a
Ben Pfaff said:

<snip>
There is occasionally a good reason to use strncpy().
Right. I'm aware of the issues that are raised by misuse of strncpy - but
hey, any function can be misused. That doesn't necessarily make it a bad
function.

<snip>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Oct 2 '07 #21

P: n/a
n3o
On Oct 2, 8:32 am, Joe Mayo <joe.m...@supermail.tldwrote:
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.
well, I believe that OOP and Procederal Programming is all a matter of
personal preference, or even the task at hand. Sometimes you, or the
company that you work for, may need an in-house function or tool that
will carry out a desird task. If that is the case, a really in-depth
OOP approach may not be the desired way to achieve the task.
Therefore, it is always best to carefully analyse what type of
approach to take when you begin to implement the program.

n3o
- "You can't consider the problem of defense without first
understanding the problem of attack." -

Oct 2 '07 #22

P: n/a
Richard Heathfield wrote:

Nonsense. Since he doesn't read the answers I write, he misunderstands
everything from misquoted posts.

The original poster says:

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.

Then, Mr Mark Bluemel answers:
I think I become more and more alone...
Try bathing occasionally...

Why this insult?

No reason. I object to that and send a message saying to Mr Bluemel that
being nasty just doesn't cut it.

And then, the Ambuhlance steps in (he always does) saying that
(of course) *I* am the culprit ans starts sending insults...

Forget it guys!

Just keep me in your killfile.
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Oct 2 '07 #23

P: n/a
jacob navia wrote:
Richard Heathfield wrote:

Nonsense. Since he doesn't read the answers I write, he misunderstands
everything from misquoted posts.

The original poster says:

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.

Then, Mr Mark Bluemel answers:
I think I become more and more alone...

Try bathing occasionally...

Why this insult?

No reason. I object to that and send a message saying to Mr Bluemel that
being nasty just doesn't cut it.
Mark already gave his reasons.
And then, the Ambuhlance steps in
Now this _is_ insulting. If you don't want to see insults shouldn't you
refrain from insulting others?

<snip>

Oct 2 '07 #24

P: n/a
Joe Mayo wrote:
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?
A "C vs C++" discussion, is a typical flame bate. :)

Bad code can be written regardless of language. My first programming
language was Simula, so OO techniques came naturally, still I ended up
as a C programmer.

My CS teacher said:

"Programming OO (Simula) is like driving a Volvo, while C programming is
driving a Ferrari."

Those days, Volvo was safe, but not very fast.

--
Tor <torust [at] online [dot] no>

"Walking on water and developing software from a specification are easy
if both are frozen"
Oct 2 '07 #25

P: n/a
On Oct 2, 7:04 pm, jacob navia <ja...@nospam.orgwrote:
Richard Heathfield wrote:

Nonsense. Since he doesn't read the answers I write, he misunderstands
everything from misquoted posts.

The original poster says:

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.

Then, Mr Mark Bluemel answers:
I think I become more and more alone...

Try bathing occasionally...

Why this insult?

No reason. I object to that and send a message saying to Mr Bluemel that
being nasty just doesn't cut it.
Why did you consider it an insult? It's clearly meant as a joke.
Perhaps it is your sense of humor that is at fault.
>
And then, the Ambuhlance steps in (he always does) saying that
(of course) *I* am the culprit ans starts sending insults...
On the other hand, "the Ambuhlance" comes across as something intended
to be gratuitously insulting, rather than playful or affectionate.
>
Forget it guys!

Just keep me in your killfile.

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

Oct 2 '07 #26

P: n/a
Richard Heathfield wrote:
Ben Pfaff said:

<snip>
>There is occasionally a good reason to use strncpy().

Right. I'm aware of the issues that are raised by misuse of strncpy - but
hey, any function can be misused. That doesn't necessarily make it a bad
function.
A well designed API, should be consistent and simple. There are quite
some years ago now, when I told c.l.c people, that the better
alternative for strncpy() and strncat(), was provided by OpenBSD
strlcpy() and strlcat().

Apparently, the standards people didn't agree, so now we have strcpy_s()
and strcat_s().
--
Tor <torust [at] online [dot] no>

"Walking on water and developing software from a specification are easy
if both are frozen"
Oct 2 '07 #27

P: n/a
jacob navia said:
Richard Heathfield wrote:

Nonsense. Since he doesn't read the answers I write, he misunderstands
everything from misquoted posts.
Actually, my filter is off at the moment, so I can see exactly what you are
writing, and no misquoting is involved. Furthermore, I have read a great
many of your articles in the past, so I know your style very well. That's
why I killfiled you in the first place. Once those two threads have died,
I'll be putting the filter back in place, and your bile can once more go
unsung. I can hardly wait.
>
The original poster says:

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.

Then, Mr Mark Bluemel answers:
I think I become more and more alone...

Try bathing occasionally...

Why this insult?
Try not to be so obtuse. It's A Joke. Duh. A well-crafted joke? No, not
really. Funny? Not terribly. Even so, the intent was clearly supposed to
be humorous.

<snip>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Oct 2 '07 #28

P: n/a
Tor Rustad said:

<snip>
alternative for strncpy() and strncat(), was provided by OpenBSD
strlcpy() and strlcat().
....which I don't need and don't use.
Apparently, the standards people didn't agree, so now we have strcpy_s()
and strcat_s().
I don't need or use those, either.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Oct 2 '07 #29

P: n/a
Richard Heathfield wrote:
Tor Rustad said:

<snip>
>alternative for strncpy() and strncat(), was provided by OpenBSD
strlcpy() and strlcat().

...which I don't need and don't use.

If you *need* such functions, I can recommend "Standard C Library", by
P. J. Plauger.

--
Tor <torust [at] online [dot] no>

"Walking on water and developing software from a specification are easy
if both are frozen"
Oct 2 '07 #30

P: n/a
"Richard Heathfield" <rj*@see.sig.invalida écrit dans le message de news:
NN*********************@bt.com...
Ben Pfaff said:

<snip>
>There is occasionally a good reason to use strncpy().

Right. I'm aware of the issues that are raised by misuse of strncpy - but
hey, any function can be misused. That doesn't necessarily make it a bad
function.
You are right, it is a matter of statistics. strncpy happens to be misused
a lot, causing various kinds of inefficiencies or downright bugs that lurk
in the dark corners of the code, waiting to bite at the least agreeable
moment.

Just don't use this stinking function, use strlcpy or equivalent instead,
when appropriate.

--
Chqrlie.
Oct 2 '07 #31

P: n/a

"Charlie Gordon" <ne**@chqrlie.orgwrote in message
>
You are right, it is a matter of statistics. strncpy happens to be
misused a lot, causing various kinds of inefficiencies or downright bugs
that lurk in the dark corners of the code, waiting to bite at the least
agreeable moment.

Just don't use this stinking function, use strlcpy or equivalent instead,
when appropriate.
The problem is that people think it is a general purpose safe or sub-string
strcpy() replacement.
It isn't. It is designed for copying strings to fixed length database fileds
where there is no necessary terminating nul and no random padding characters
are allowed. For that purpose it is exactly what you wnat.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

Oct 2 '07 #32

P: n/a
On Tue, 2 Oct 2007 21:35:31 +0200, "Charlie Gordon" <ne**@chqrlie.org>
wrote:
>"Richard Heathfield" <rj*@see.sig.invalida écrit dans le message de news:
NN*********************@bt.com...
>Ben Pfaff said:

<snip>
>>There is occasionally a good reason to use strncpy().

Right. I'm aware of the issues that are raised by misuse of strncpy - but
hey, any function can be misused. That doesn't necessarily make it a bad
function.

You are right, it is a matter of statistics. strncpy happens to be misused
a lot, causing various kinds of inefficiencies or downright bugs that lurk
in the dark corners of the code, waiting to bite at the least agreeable
moment.

Just don't use this stinking function, use strlcpy or equivalent instead,
when appropriate.
Not available on any implementation I currently use. Use strncpy when
appropriate. When it's not, I would rather write my own function than
use strlcpy, which has different implementations on different
platforms, leading to bad assumptions by programmers, among other
problems. Even GCC decided not to add it :-)

--
Al Balmer
Sun City, AZ
Oct 2 '07 #33

P: n/a
On Tue, 2 Oct 2007 20:07:57 +0100, "Malcolm McLean"
<re*******@btinternet.comwrote:
>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?
You mean "procedural". Functional programming is what lisp does.
You may be right about what he meant, but let's not forget that
"functional" is a standard English word, and "functional way" may not
refer to functional programming.

--
Al Balmer
Sun City, AZ
Oct 2 '07 #34

P: n/a
Al Balmer wrote:
On Tue, 2 Oct 2007 21:35:31 +0200, "Charlie Gordon" <ne**@chqrlie.org>
wrote:
[...]
>Just don't use this stinking function, use strlcpy or equivalent instead,
when appropriate.

Not available on any implementation I currently use.
Same here, but I even so used these OpenBSD interfaces since year
2000... go figure.

Use strncpy when
appropriate. When it's not, I would rather write my own function than
use strlcpy, which has different implementations on different
platforms, leading to bad assumptions by programmers, among other
problems.
Shouldn't be a problem for the implementations you use! :-)

Even GCC decided not to add it :-)
Did you follow the GNU discussion back then? IIRC, the main argument
against it, was that few C programmers, demanded these functions and
that rolling your own would be easy.

Things are different now, hasn't even Gwyn put forward a safe
replacement for gets()? Also we have, TR 24731 "Part I: Bounds-checking
interfaces", recommending all those *_s functions.

--
Tor <torust [at] online [dot] no>

"Life is full of shit, if you look at it"
Oct 2 '07 #35

P: n/a
"Al Balmer" <al******@att.neta écrit dans le message de news:
to********************************@4ax.com...
On Tue, 2 Oct 2007 21:35:31 +0200, "Charlie Gordon" <ne**@chqrlie.org>
wrote:
>>"Richard Heathfield" <rj*@see.sig.invalida écrit dans le message de
news:
NN*********************@bt.com...
>>Ben Pfaff said:

<snip>

There is occasionally a good reason to use strncpy().

Right. I'm aware of the issues that are raised by misuse of strncpy -
but
hey, any function can be misused. That doesn't necessarily make it a bad
function.

You are right, it is a matter of statistics. strncpy happens to be
misused
a lot, causing various kinds of inefficiencies or downright bugs that lurk
in the dark corners of the code, waiting to bite at the least agreeable
moment.

Just don't use this stinking function, use strlcpy or equivalent instead,
when appropriate.

Not available on any implementation I currently use. Use strncpy when
appropriate. When it's not, I would rather write my own function than
use strlcpy, which has different implementations on different
platforms, leading to bad assumptions by programmers, among other
problems. Even GCC decided not to add it :-)
I agree with you. That's what I meant by "or equivalent". I have my own
implementation as well.
strlcpy was not included in the GLIBC, because they are non-believers: there
are many instances of strncpy in the GLIBC, most of which are wrong and
could have been fixed with strlcpy.

It's a shame the committee would not define a proper library function for
limited string copy and concatenation, so everybody can safely rely on a
standardized, well defined API. A revamped stream and string parsing API
would also have helped more than VLAs.

--
Chqrlie.
Oct 2 '07 #36

P: n/a
On Oct 2, 7:04 pm, jacob navia <ja...@nospam.orgwrote:
Richard Heathfield wrote:

Nonsense. Since he doesn't read the answers I write, he misunderstands
everything from misquoted posts.

The original poster says:

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.

Then, Mr Mark Bluemel answers:
I think I become more and more alone...

Try bathing occasionally...

Why this insult?
What insult?
No reason. I object to that and send a message saying to Mr Bluemel that
being nasty just doesn't cut it.
Of course it doesn't, but where was he being nasty? This was obviously
a joke.

Oct 2 '07 #37

P: n/a
J. J. Farrell wrote:
On Oct 2, 7:04 pm, jacob navia <ja...@nospam.orgwrote:
>Richard Heathfield wrote:

Nonsense. Since he doesn't read the answers I write, he misunderstands
everything from misquoted posts.

The original poster says:

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.

Then, Mr Mark Bluemel answers:
> I think I become more and more alone...

Try bathing occasionally...

Why this insult?

What insult?
>No reason. I object to that and send a message saying to Mr Bluemel that
being nasty just doesn't cut it.

Of course it doesn't, but where was he being nasty? This was obviously
a joke.

Of course!

How FUNNY!

So you approve that when somebody asks a perfectly valid question
(or even a bad question who cares) the "regulars" in c.l.c have the
right to laugh at him and recommend him to "take a bath".

This is one of the basic tenants of group cohesion here: to laugh at the
beginner is used in all groups to solidify group cohesion against the
new participants, at the expense of the new ones that are
perceived as weaker and isolated.

Please do not answer any more. Just take a bath pal.
Even your emails stink.

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Oct 2 '07 #38

P: n/a
Charlie Gordon said:

<snip>
there are many instances of strncpy in the GLIBC, most of which are wrong
I'm all for fixing incorrect usages of strncpy, but it's not strncpy's
fault if it's misused.

<snip>
It's a shame the committee would not define a proper library function for
limited string copy and concatenation,
Perhaps - but that is not what strncpy is for.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Oct 2 '07 #39

P: n/a
jacob navia said:
J. J. Farrell wrote:
>On Oct 2, 7:04 pm, jacob navia <ja...@nospam.orgwrote:
<snip>
>> being nasty just doesn't cut it.

Of course it doesn't, but where was he being nasty? This was obviously
a joke.

Of course!

How FUNNY!

So you approve that when somebody asks a perfectly valid question
(or even a bad question who cares) the "regulars" in c.l.c have the
right to laugh at him and recommend him to "take a bath".
Nobody was laughing *at* him. It was just a joke. Not a terribly good one,
I'll grant you, but that's all it was.
This is one of the basic tenants of group cohesion here: to laugh at the
beginner
I don't laugh at beginners. I *would* laugh at your Usenet articles,
though, if I were the kind of person to laugh at tragedy.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Oct 2 '07 #40

P: n/a
On Tue, 02 Oct 2007 22:47:19 +0200, Tor Rustad
<to********@hotmail.comwrote:
>Al Balmer wrote:
>On Tue, 2 Oct 2007 21:35:31 +0200, "Charlie Gordon" <ne**@chqrlie.org>
wrote:

[...]

>Even GCC decided not to add it :-)

Did you follow the GNU discussion back then? IIRC, the main argument
against it, was that few C programmers, demanded these functions and
that rolling your own would be easy.
Only sporadically, since I didn't have any strong feelings either way.
I remember claims that there was no evidence that they made things
safer, despite their long history in BSD, and that it's better for
programmers to be aware of how long their strings are, rather than
having to check whether data was truncated. I certainly agree with the
last, since programmers who can't properly handle strings are probably
among those who never check return values :-)
>
Things are different now, hasn't even Gwyn put forward a safe
replacement for gets()? Also we have, TR 24731 "Part I: Bounds-checking
interfaces", recommending all those *_s functions.
A little while ago, I was asked to enhance a Windows program I wrote a
few years ago. An upgrade to the latest Visual Studio was required, as
well. One of our regular Windows programmers was happy to tell me how
to turn off the warnings about not using the *_s functions <G>.

--
Al Balmer
Sun City, AZ
Oct 2 '07 #41

P: n/a
On Tue, 02 Oct 2007 15:31:50 +0100, in comp.lang.c , Mark Bluemel
<ma**********@pobox.comwrote:
>I don't think that in general my postings in this group are about
insulting people or being nasty. If I have given that impression, I'm
rather disappointed.
Don't worry, they aren't and they don't.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Oct 2 '07 #42

P: n/a
On Tue, 02 Oct 2007 20:04:45 +0200, in comp.lang.c , jacob navia
<ja***@nospam.orgwrote:
>Then, Mr Mark Bluemel answers:
>>Try bathing occasionally...

Why this insult?
Its not an insult, its a joke. Your inability to detect them is on a
part with your inability to enter into friendly conversations and your
propensity to launch into verbal diatribes at the slightest pretext.
>Just keep me in your killfile.
Dream on.

--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Oct 2 '07 #43

P: n/a
On Tue, 02 Oct 2007 23:10:28 +0200, in comp.lang.c , jacob navia
<ja***@nospam.orgwrote:
>J. J. Farrell wrote:
>>
Of course it doesn't, but where was he being nasty? This was obviously
a joke.

So you approve that when somebody asks a perfectly valid question
(or even a bad question who cares) the "regulars" in c.l.c have the
right to laugh at him and recommend him to "take a bath".
*sigh*

Try turning off your paranoia occasionally?
>Please do not answer any more. Just take a bath pal.
Even your emails stink.
Talk about offensive and nasty.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Oct 2 '07 #44

P: n/a
On Tue, 02 Oct 2007 23:10:28 +0200, in comp.lang.c , jacob navia
<ja***@nospam.orgwrote:
>Of course!

How FUNNY!

So you approve that when somebody asks a perfectly valid question
(or even a bad question who cares) the "regulars" in c.l.c have the
right to laugh at him and recommend him to "take a bath".

This is one of the basic tenants of group cohesion here: to laugh at the
beginner is used in all groups to solidify group cohesion against the
new participants, at the expense of the new ones that are
perceived as weaker and isolated.

Please do not answer any more. Just take a bath pal.
Even your emails stink.
Reading this and other posts made recently, I am reminded strongly of
some of the comment we got some years ago from the likes of Karl the
Chair and Bill. If my interpretation is correct and of course it may
be wildly wrong in which case I unreservedly apologise for any
distress and so forth, it would be unfair to respond as the poster may
not be entirely responsible. I'm therefore sticking JN into my
killfile indefinitely, and will deal similarly with any thread that
seems to be affected. This troubles me as I do still feel his
erroneous posts need correction. Undoubtedly however there will be
others who carry on that battle.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Oct 2 '07 #45

P: n/a
Mark McIntyre wrote:
On Tue, 02 Oct 2007 23:10:28 +0200, in comp.lang.c , jacob navia
<ja***@nospam.orgwrote:
>J. J. Farrell wrote:
>>Of course it doesn't, but where was he being nasty? This was obviously
a joke.
So you approve that when somebody asks a perfectly valid question
(or even a bad question who cares) the "regulars" in c.l.c have the
right to laugh at him and recommend him to "take a bath".

*sigh*

Try turning off your paranoia occasionally?
>Please do not answer any more. Just take a bath pal.
Even your emails stink.

Talk about offensive and nasty.
Ahhh but it was a JOKE!

Jut a JOKE!

You didn't find it FUNNY?
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Oct 2 '07 #46

P: n/a
Ben Pfaff <bl*@cs.stanford.eduwrites:
[...]
There is occasionally a good reason to use strncpy(). However:

* Using strncpy() into a large buffer can be very inefficient.
strncpy() always writes to every byte in the destination
buffer, which can waste a lot of time if the destination
buffer is much longer than the source string.

* If the source string is longer than the size of the
destination buffer, then strncpy() doesn't write a
terminating null. So a call to strncpy() must be followed
by explicitly writing a null terminator at the end of the
destination buffer in most cases.
If strncpy() didn't write a null terminator, it usually means that not
all of the source string was copied. Just writing a null terminator
is probably the best thing to do sometimes, but often this should be
treated as an error and handled in some arbitrarily complex manner.

If strncpy() *does* copy the entire source string but doesn't write a
null terminator, then there isn't room to write one anyway (unless you
overwrite the last character of the string).

Of course, if there wasn't room in the target array to hold the source
string, it's not strcnpy()'s fault; you'll have to deal with it no
matter what you use.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Oct 2 '07 #47

P: n/a
Al Balmer <al******@att.netwrites:
On Tue, 2 Oct 2007 21:35:31 +0200, "Charlie Gordon" <ne**@chqrlie.org>
wrote:
[...]
>>Just don't use this stinking function, use strlcpy or equivalent instead,
when appropriate.

Not available on any implementation I currently use. Use strncpy when
appropriate. When it's not, I would rather write my own function than
use strlcpy, which has different implementations on different
platforms, leading to bad assumptions by programmers, among other
problems. Even GCC decided not to add it :-)
<SOMEWHAT_OT>
Quibble: gcc doesn't provide (most of) the C library. I think you
mean that glibc doesn't provide it.
</SOMEWHAT_OT>

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Oct 2 '07 #48

P: n/a
jacob navia <ja***@nospam.orgwrites:
[...]
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!
[...]

Will you *please* stop making that false claim?

Zero-terminated buffers are the only string format provided by
standard C. (In C, the term "string" refers to a data format, not to
a data type.) It's straightforward to provide C code that implements
other string formats and/or types, and many people have done so. I
don't recall anybody here ever objecting to that.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Oct 2 '07 #49

P: n/a
Al Balmer <al******@att.netwrites:
On Tue, 2 Oct 2007 20:07:57 +0100, "Malcolm McLean"
<re*******@btinternet.comwrote:
>>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?
You mean "procedural". Functional programming is what lisp does.

You may be right about what he meant, but let's not forget that
"functional" is a standard English word, and "functional way" may not
refer to functional programming.
The subject header is:

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

It seems clear that the OP is simply using the technical term
"functional programming" incorrectly, where he should have used
"procedural programming".

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Oct 2 '07 #50

139 Replies

This discussion thread is closed

Replies have been disabled for this discussion.