Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > C (functional programming) VS C++ (object oriented programming)

Reply
Thread Tools

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

 
 
santosh
Guest
Posts: n/a
 
      10-02-2007
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.

 
Reply With Quote
 
 
 
 
Richard Heathfield
Guest
Posts: n/a
 
      10-02-2007
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
 
Reply With Quote
 
 
 
 
Richard
Guest
Posts: n/a
 
      10-02-2007
Martin Ambuhl <(E-Mail Removed)> writes:

> 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.
 
Reply With Quote
 
Ben Pfaff
Guest
Posts: n/a
 
      10-02-2007
Richard Heathfield <(E-Mail Removed)> writes:

> 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 1utchar(a[i&15]);break;}}}
 
Reply With Quote
 
Laurent Deniau
Guest
Posts: n/a
 
      10-02-2007
On 2 oct, 18:13, Friedrich Dominicus <just-for-news-fr...@q-software-
solutions.de> wrote:
> Richard Heathfield <(E-Mail Removed)> writes:
>
> > 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
> 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.

 
Reply With Quote
 
Richard Heathfield
Guest
Posts: n/a
 
      10-02-2007
Richard said:

> Martin Ambuhl <(E-Mail Removed)> writes:
>

<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
 
Reply With Quote
 
Richard Heathfield
Guest
Posts: n/a
 
      10-02-2007
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
 
Reply With Quote
 
n3o
Guest
Posts: n/a
 
      10-02-2007
On Oct 2, 8:32 am, Joe Mayo <(E-Mail Removed)> 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?
>
> --
> -= 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." -

 
Reply With Quote
 
jacob navia
Guest
Posts: n/a
 
      10-02-2007
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
 
Reply With Quote
 
santosh
Guest
Posts: n/a
 
      10-02-2007
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>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
class-oriented rather than object-oriented? notnorwegian@yahoo.se Python 2 05-26-2008 04:42 PM
Object oriented does not mean class oriented rolo Ruby 3 04-09-2004 02:51 PM
object-oriented perl nus Perl 0 12-24-2003 07:04 AM
Aspect oriented Everything? New_aspect Perl 5 08-31-2003 03:01 PM
DATA ACCESS COMPONENT (OBJECT ORIENTED) DRU ASP .Net 1 08-22-2003 12:01 AM



Advertisments