Re: Newbie: The C / C++ Issue

2003-11-13 Thread Peter Ulrich Kruppa
On Tue, 11 Nov 2003, Alex Kelly wrote:

 Thanks for all of the great suggestions to my previous question!

 Yet, the responses have led me to another question. If C++ is
 newer and more advanced than C, will it replace C? If so,
 should I learn C++ and forget C?
Good advice:
Have a look at Bruce Eckel's free, though excellent, electronic
books at
http://mindview.net/Books/
Thinking in C++
and get started. FreeBSD's built in gcc should do all you need
for the beginning.

- And: Have fun!

Uli.



 Alex
 ___
 [EMAIL PROTECTED] mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]



+---+
|Peter Ulrich Kruppa|
| Wuppertal |
|  Germany  |
+---+
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Newbie: The C / C++ Issue

2003-11-13 Thread Chris Howells
 On Tue, 11 Nov 2003, Alex Kelly wrote:
 Good advice:
 Have a look at Bruce Eckel's free, though excellent, electronic
 books at
 http://mindview.net/Books/
 Thinking in C++
 and get started. FreeBSD's built in gcc should do all you need
 for the beginning.

There's no way, IMO, that you can learn C++ from Thinking in C++. I
tried... and failed (though I was 15 at the time and had no previous
programming knowledge apart from trying to learn C and hating every minute
of it). It's no doubt an excellent book, I have a paper copy of it, but I
consider rather more a book for those that know a reasonable amount of C++
and want to advance their knowledge.

Cheers,
Chris Howells

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Newbie: The C / C++ Issue

2003-11-13 Thread abowhill
 Am I missing something here?  When does C have OO capability?
 Structs don't count.  What about inheritance and polymorphism?

That's in the implementation AND application.  Just because you CAN
access part of a lowly struct, doesn't mean you have to.  It's object
oriented if you OBSERVE the restricted accesses defined by OO.
Whether or not they're there is completely irrelevant.  Of course C
has OO capability, it just doesn't have its restrictions :)

The idea that C can be used to do object-oriented programming is 
a myth. The C language is not object-oriented or even object-based.
The big reason C++ is object-oriented is due to dynamic binding.

Check out the C++ FAQ lite: 
http://www.parashift.com/c++-faq-lite/big-picture.html#faq-6.8

If you declare a struct, and then implement a specific set of routines
to manipulate it, and only use those routines, except for those 'data
members' that would otherwise be public anyway, that's essentially
your class.  You're doing without all the type and access restrictions
IMPOSED by C++, but that doesn't mean you can't OBSERVE those
restrictions.  This way, when saving cpu time is critical, you can
bend those rules.  With C++, you're stuck on the long road.

You can drive your car to an open plain in the desert, and
operate the vehicle as if you were in the city, observing imaginary
stop lights, lanes and traffic. But why pretend?

The systematic constraints in C++ exist to organize code,
protect your work. They are there for the same basic reasons that 
local variables exist in C. 

 I would agree that you can write programs that do the same thing in
 all three languages above, but I don't think that OO is a waste of
 time.  OO promotes code reuse.  That is the whole point.

No one ever claimed OO was a waste of time that I noticed.  But I
don't see code reuse with C++ any more than with C.  I'm a real big
fan of code reuse, and I have reused more C code than I can remember.
Problem is that when C++ code gets reused, it's usually a template
class, in which case, you'd probably be better off with C anyway.

There are so many different ways to re-use code. Even cutting and 
pasting, which is essentially what the STL does. (correct me if
I am wrong)

If you are going to re-use code, at least be organized, make
a good interface, and don't re-invent the wheel unless you
have to. C, C++, whatever.

 Using C++ implies a state of mind.  You can write code like in C,
 but it defeats the purpose of using an OO language.

Not sure what you mean by this, but if using C++ is a state of mind,
why can't that state of mind affect the way C code is written?  And it
doesn't defeat the purpose if you misbehave regularly and NEED the
unbreakable restrictions.

Components in the real-world problem map directly to objects in the
program. C++ was designed to be used this way. C was not. 

--Allan
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Newbie: The C / C++ Issue

2003-11-13 Thread Chris Pressey
On Thu, 13 Nov 2003 11:01:54 -0800
abowhill [EMAIL PROTECTED] wrote:

  Am I missing something here?  When does C have OO capability?
  Structs don't count.  What about inheritance and polymorphism?
 
 That's in the implementation AND application.  Just because you CAN
 access part of a lowly struct, doesn't mean you have to.  It's
 objectoriented if you OBSERVE the restricted accesses defined by OO.
 Whether or not they're there is completely irrelevant.  Of course C
 has OO capability, it just doesn't have its restrictions :)
 
 The idea that C can be used to do object-oriented programming is 
 a myth. The C language is not object-oriented or even object-based.
 The big reason C++ is object-oriented is due to dynamic binding.

I don't think I buy that.  With that reasoning, couldn't you say that
any program in any language that does any sort of dynamic binding (for
example, opening a .so file) is object-oriented?

The way I see it is that object-orientation is a methodology, and
languages aren't methodologies, so it's absurd to say that some language
is or isn't object-oriented.  (I mean, we all know that the Bourne
shell is object-oriented,[1] right? :)  The best you can do is to
describe the degree to which some language supports or enforces
object-oriented programming.  Incidental to that, C++ provides many
abstractions which support object-oriented programming, while not
enforcing them in any way.

But this is getting far off topic for this list; the bare facts remain:

- much of FreeBSD (kernel, userland) is written in C
- many FreeBSD ports are written in C++

So, as stated several times now, it really depends on what you want to
work on.

-Chris

[1]
http://www.usenix.org/publications/library/proceedings/bos94/haemer.html
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Newbie: The C / C++ Issue

2003-11-13 Thread Louis LeBlanc
I hate to seem like a jerk, but I get these messages through the list
already, and see no reason to get them in multiple boxes.  Please feel
free to continue this discussion on list, but please take this email
out of the recipients list.  I will join in when I am able.  Granted
that doesn't guarantee I'll agree with everyone, but then it wouldn't
be much of a discussion, would it? :)

Cheers.
Lou
On 11/13/03 11:42 AM, Chris Pressey sat at the `puter and typed:
 On Thu, 13 Nov 2003 11:01:54 -0800
 abowhill [EMAIL PROTECTED] wrote:
 
   Am I missing something here?  When does C have OO capability?
   Structs don't count.  What about inheritance and polymorphism?
  
  That's in the implementation AND application.  Just because you CAN
  access part of a lowly struct, doesn't mean you have to.  It's
  objectoriented if you OBSERVE the restricted accesses defined by OO.
  Whether or not they're there is completely irrelevant.  Of course C
  has OO capability, it just doesn't have its restrictions :)
  
  The idea that C can be used to do object-oriented programming is 
  a myth. The C language is not object-oriented or even object-based.
  The big reason C++ is object-oriented is due to dynamic binding.
 
 I don't think I buy that.  With that reasoning, couldn't you say that
 any program in any language that does any sort of dynamic binding (for
 example, opening a .so file) is object-oriented?
 
 The way I see it is that object-orientation is a methodology, and
 languages aren't methodologies, so it's absurd to say that some language
 is or isn't object-oriented.  (I mean, we all know that the Bourne
 shell is object-oriented,[1] right? :)  The best you can do is to
 describe the degree to which some language supports or enforces
 object-oriented programming.  Incidental to that, C++ provides many
 abstractions which support object-oriented programming, while not
 enforcing them in any way.
 
 But this is getting far off topic for this list; the bare facts remain:
 
 - much of FreeBSD (kernel, userland) is written in C
 - many FreeBSD ports are written in C++
 
 So, as stated several times now, it really depends on what you want to
 work on.
 
 -Chris
 
 [1]
 http://www.usenix.org/publications/library/proceedings/bos94/haemer.html
 
 

-- 
Louis LeBlanc   [EMAIL PROTECTED]
Fully Funded Hobbyist, KeySlapper Extrordinaire :)
http://www.keyslapper.org ԿԬ

Satellite Safety Tip #14:
  If you see a bright streak in the sky coming at you, duck.
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Newbie: The C / C++ Issue

2003-11-13 Thread Viktor Lazlo


On Thu, 13 Nov 2003, Louis LeBlanc wrote:

 I hate to seem like a jerk, but I get these messages through the list
 already, and see no reason to get them in multiple boxes.  Please feel
 free to continue this discussion on list, but please take this email
 out of the recipients list.  I will join in when I am able.  Granted
 that doesn't guarantee I'll agree with everyone, but then it wouldn't
 be much of a discussion, would it? :)

Please take it out of freebsd-questions altogether and move it to
freebsd-chat or personal email or a c/c++ list.

Thanks,

Viktor
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Newbie: The C / C++ Issue

2003-11-12 Thread Matthew Seaman
On Tue, Nov 11, 2003 at 10:00:33PM -0500, Lucas Holt wrote:

   I'm also starting to learn objective C (the 
 competitor to C++) so that I can utilize my Macintosh as a development 
 platform.  The reason apple used objective C was because Mac OS X is 
 really Nextstep which was written in like 1988 or so.

It was always said that if you knew C, you could learn Obj-C in a few
hours.  And in a legalistic sense, that is true: Obj-C is a superset
of C, and once you've got the method call syntax down:

[anObject withAnArgument: foo andAnother: bar ];

and about 4 or 5 other things, you've got the whole language syntax
down.

All that remains then is to become familiar with the whole panoply of
the AppKit which will take you of the order of Months to do.  Plus
learning about effective OO design -- the whole semantic structure of
the language.  Obj-C is really nice in that regard: like chess, you
can learn the rules very quickly, and start playing effectively
immediately.  And because playing is easy, it frees you to learn the
subtleties.

Once you've mastered Obj-C and if you then start looking at Java,
you'll find things seem eerily familiar -- although the Java syntax is
superficially more like C++, Java was based pretty closely on the
semantics of Obj-C.

Cheers,

Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.   26 The Paddocks
  Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey Marlow
Tel: +44 1628 476614  Bucks., SL7 1TH UK


pgp0.pgp
Description: PGP signature


Re: Newbie: The C / C++ Issue

2003-11-12 Thread Chris Pressey
On Tue, 11 Nov 2003 21:06:51 -0500
Alex Kelly [EMAIL PROTECTED] wrote:

 Thanks for all of the great suggestions to my previous question!
 
 Yet, the responses have led me to another question. If C++ is newer
 and more advanced than C, will it replace C?

Unlikely.  Old languages die hard - it's a bit scary to think of all
the systems out there that are still running programs written in
FORTRAN, COBOL, Business BASIC, and MUMPS (and incidentally will
continue to run those programs until it becomes cost-ineffective to do
so - which is to say, probably indefinately.)

 If so, should I learn C++ and forget C?

If you want an appreciation of how computers actually work, learn the
language that many call portable(ish) assembly code - C.

If you don't really care how computers actually work, and you just want
an elegant way to specify algorithms, learn Haskell.

If you want something in-between, learn Erlang.

And if you want a job in a cubicle, learn C++ or Java.

Just MHO,
-Chris
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Newbie: The C / C++ Issue

2003-11-12 Thread Jerry McAllister
 
 On Tue, 11 Nov 2003 21:06:51 -0500
 Alex Kelly [EMAIL PROTECTED] wrote:
 
  Thanks for all of the great suggestions to my previous question!
  
  Yet, the responses have led me to another question. If C++ is newer
  and more advanced than C, will it replace C?
 
 Unlikely.  Old languages die hard - it's a bit scary to think of all
 the systems out there that are still running programs written in
 FORTRAN, COBOL, Business BASIC, and MUMPS (and incidentally will
 continue to run those programs until it becomes cost-ineffective to do
 so - which is to say, probably indefinately.)

As several have mentioned, it depends on what you are doing.
For some things Fortran is still best.   Not everyone spends
all their time hacking OSen.   Some try to do actual work with 
their machine (not me, of coure.

jerry

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Newbie: The C / C++ Issue

2003-11-12 Thread Marty Leisner

I've been programming in C for over 20 years.

I've gotten up to speed on C++ for work.

I like the expression in C you can shoot yourself in the foot,
in C++ you can blow off your leg.

C++ does have advantages -- but I haven't seen most C++ 
programmers use them -- instead they often obscure the
problem at hand by making the implementation more complicated
than the problem they're trying to solve.

BTW -- I've been doing object oriented stuff in C for years --
its harder, but its doable.  You have a much simpler language
to deal with.

First learn how to write good programs in C.
Then see if C++ buys you anything extra.
If it doesn't, you don't need C++.
But I've seen far too much C++ that's just obscure C.

Just my experience and opinion.

marty

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Newbie: The C / C++ Issue

2003-11-12 Thread Lucas Holt
On Nov 12, 2003, at 8:37 PM, Marty Leisner wrote:



BTW -- I've been doing object oriented stuff in C for years --
its harder, but its doable.  You have a much simpler language
to deal with.
First learn how to write good programs in C.
Then see if C++ buys you anything extra.
If it doesn't, you don't need C++.
But I've seen far too much C++ that's just obscure C.
Just my experience and opinion.

marty
Am I missing something here?  When does C have OO capability?  Structs 
don't count.  What about inheritance and polymorphism?

To me a struct is like a VCR with no record button.  You can view the 
content, but you can't manipulate it with the struct.  If i want to do 
something to destroy the tape, I must apply a magnet from an outside 
source (much like a plain old function).  And classes provide security, 
much like the tab on the front of the tape.  The data is private if the 
tab is puched out.  (ok thats a bad analogy)

If C had OO features, then why do we have C++ and Objective C?

I would agree that you can write programs that do the same thing in all 
three languages above, but I don't think that OO is a waste of time.  
OO promotes code reuse.  That is the whole point.

Using C++ implies a state of mind.  You can write code like in C, but 
it defeats the purpose of using an OO language.

Lucas Holt
[EMAIL PROTECTED]

FoolishGames.com  (Jewel Fan Site)
JustJournal.com (Free blogging)
Only two things are infinite, the universe and human stupidity, and 
I'm not sure about the former.
- Albert Einstein (1879-1955)

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Newbie: The C / C++ Issue

2003-11-12 Thread Louis LeBlanc
On 11/12/03 09:36 PM, Lucas Holt sat at the `puter and typed:
 
 On Nov 12, 2003, at 8:37 PM, Marty Leisner wrote:
 
 
 
  BTW -- I've been doing object oriented stuff in C for years --
  its harder, but its doable.  You have a much simpler language to
  deal with.
 
  First learn how to write good programs in C.  Then see if C++ buys
  you anything extra.  If it doesn't, you don't need C++.  But I've
  seen far too much C++ that's just obscure C.
 
  Just my experience and opinion.
 
  marty
 
 Am I missing something here?  When does C have OO capability?
 Structs don't count.  What about inheritance and polymorphism?

That's in the implementation AND application.  Just because you CAN
access part of a lowly struct, doesn't mean you have to.  It's object
oriented if you OBSERVE the restricted accesses defined by OO.
Whether or not they're there is completely irrelevant.  Of course C
has OO capability, it just doesn't have its restrictions :)

 To me a struct is like a VCR with no record button.  You can view
 the content, but you can't manipulate it with the struct.  If i want
 to do something to destroy the tape, I must apply a magnet from an
 outside source (much like a plain old function).  And classes
 provide security, much like the tab on the front of the tape.  The
 data is private if the tab is puched out.  (ok thats a bad analogy)

Seems to me it's more like a VCR tape with the tab taped over.

If you declare a struct, and then implement a specific set of routines
to manipulate it, and only use those routines, except for those 'data
members' that would otherwise be public anyway, that's essentially
your class.  You're doing without all the type and access restrictions
IMPOSED by C++, but that doesn't mean you can't OBSERVE those
restrictions.  This way, when saving cpu time is critical, you can
bend those rules.  With C++, you're stuck on the long road.

 If C had OO features, then why do we have C++ and Objective C?

Because some people like C++ better.

 I would agree that you can write programs that do the same thing in
 all three languages above, but I don't think that OO is a waste of
 time.  OO promotes code reuse.  That is the whole point.

No one ever claimed OO was a waste of time that I noticed.  But I
don't see code reuse with C++ any more than with C.  I'm a real big
fan of code reuse, and I have reused more C code than I can remember.
Problem is that when C++ code gets reused, it's usually a template
class, in which case, you'd probably be better off with C anyway.
When I reuse C code, it's a copied data structure and a set of
routines that will apply to the task at hand, not a third generation
inherited template class with half it's methods redefined.

 Using C++ implies a state of mind.  You can write code like in C,
 but it defeats the purpose of using an OO language.

Not sure what you mean by this, but if using C++ is a state of mind,
why can't that state of mind affect the way C code is written?  And it
doesn't defeat the purpose if you misbehave regularly and NEED the
unbreakable restrictions.

Just another $0.02

L
-- 
Louis LeBlanc   [EMAIL PROTECTED]
Fully Funded Hobbyist, KeySlapper Extrordinaire :)
http://www.keyslapper.org ԿԬ

You're a good example of why some animals eat their young.
-- Jim Samuels to a heckler
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Newbie: The C / C++ Issue

2003-11-12 Thread paul van den bergen
On Thu, 13 Nov 2003 02:24 pm, Louis LeBlanc wrote:
 On 11/12/03 09:36 PM, Lucas Holt sat at the `puter and typed:
  On Nov 12, 2003, at 8:37 PM, Marty Leisner wrote:
   BTW -- I've been doing object oriented stuff in C for years --
   its harder, but its doable.  You have a much simpler language to
   deal with.
   marty
 
  Am I missing something here?  When does C have OO capability?
  Structs don't count.  What about inheritance and polymorphism?

 That's in the implementation AND application.  Just because you CAN
 access part of a lowly struct, doesn't mean you have to.  It's object
 oriented if you OBSERVE the restricted accesses defined by OO.
 Whether or not they're there is completely irrelevant.  Of course C
 has OO capability, it just doesn't have its restrictions :)

don't confuse the language with the philosophy...

programming styles - OO, procedural, functional, whatever, are methods or even 
rulesets.  some languages suit one or the other better or worse.  One could 
write functionally in C++ if one had to... but *ouch*  ditto C wrt OO.  the 
thing is that modular C programming is scalable in ways similar to OO.  
that's sort of part way to OO.  the rest of it - inheretance, etc. when 
automated in C++ v's C make C++ more suitable to OO programming.

IMHO, ofcourse.

-- 
Dr Paul van den Bergen
Centre for Advanced Internet Architectures
caia.swin.edu.au
[EMAIL PROTECTED]
IM:bulwynkl2002
And some run up hill and down dale, knapping the chucky stones 
to pieces wi' hammers, like so many road makers run daft. 
They say it is to see how the world was made.
Sir Walter Scott, St. Ronan's Well 1824 

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Newbie: The C / C++ Issue

2003-11-12 Thread Erik Trulsson
On Wed, Nov 12, 2003 at 09:36:15PM -0500, Lucas Holt wrote:
 
 On Nov 12, 2003, at 8:37 PM, Marty Leisner wrote:
 
 
 
 BTW -- I've been doing object oriented stuff in C for years --
 its harder, but its doable.  You have a much simpler language
 to deal with.
 
 First learn how to write good programs in C.
 Then see if C++ buys you anything extra.
 If it doesn't, you don't need C++.
 But I've seen far too much C++ that's just obscure C.
 
 Just my experience and opinion.
 
 marty
 
 Am I missing something here?  When does C have OO capability?  Structs 
 don't count.  What about inheritance and polymorphism?

You can write object oriented code in almost any language.
This does not mean that those languages have features that are intended
to facilitate writing object oriented code.

C does not directly support inheritance or polymorphism, but it is
quite easy to fake it by hand.  A bit more work than if you had done
it in C++, but quite doable.

 
 To me a struct is like a VCR with no record button.  You can view the 
 content, but you can't manipulate it with the struct.  If i want to do 
 something to destroy the tape, I must apply a magnet from an outside 
 source (much like a plain old function).  And classes provide security, 
 much like the tab on the front of the tape.  The data is private if the 
 tab is puched out.  (ok thats a bad analogy)
 
 If C had OO features, then why do we have C++ and Objective C?

Because C does not really have any OO features.
You can write OO code in C, but it is easier to do it in C++ or
Objective C, or some other OO langauge like Smalltalk.

 
 I would agree that you can write programs that do the same thing in all 
 three languages above, but I don't think that OO is a waste of time.  
 OO promotes code reuse.  That is the whole point.
 
 Using C++ implies a state of mind.  You can write code like in C, but 
 it defeats the purpose of using an OO language.

C++ is not really an OO langauge.  It is a language with features that
support writing OO programs, but it also has features that help writing
programs in other styles.
That is actually my main complaint against C++.  It has so many
features, and so many special cases that it is almost impossible to
actually understand the whole language.  This means that you either
have to restrict yourself to a small subset of the language (in which
case you probably better off using some other language) or run into
surprises when things don't work as you would expect.
IMO, C++ is almost never the best language for any particular task (but
on the other hand it is almost never the worst language either.)


-- 
Insert your favourite quote here.
Erik Trulsson
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Newbie: The C / C++ Issue

2003-11-12 Thread Marty Leisner

My take on computer science (which is an oxymoron) is this:

Researchers look at successful programmers and try to figure out
what they're doing.

In the 70s, it was structured programming.

In the late 80s it was object oriented.


You can manipulate the data with a struct -- put in function pointers
to methods -- which is a crude way to do polymorphism.

Don't forget -- cfront translated C++ into C code...

OO doesn't promote reuse -- good design promotes reuse.  I've been
reusing code for years.   I'm like Will Tracz -- a used program salesman ;-)
I've reused a lot of procedural code.

One of my coworkers took a C++ course, renamed her structs to classes
and thought she was doing object-oriented stuff...please...!!

The bottom line is can other people understand your program.
What I've seen is you have far less of a chance in C++ than in C.
I've recently read Stroustrup's book and got more involved in C++ --
it seems the principle of least surprise was thrown out the window.


marty

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Newbie: The C / C++ Issue

2003-11-11 Thread Alex Kelly
Thanks for all of the great suggestions to my previous question!

Yet, the responses have led me to another question. If C++ is newer and more advanced 
than C, will it replace C? If so, should I learn C++ and forget C?

Alex
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Newbie: The C / C++ Issue

2003-11-11 Thread Matthew Emmerton
 Thanks for all of the great suggestions to my previous question!

 Yet, the responses have led me to another question. If C++ is newer and
more advanced than C, will it replace C? If so, should I learn C++ and
forget C?

You can't learn C++ without learning C first.  So I'd suggest you become
intimiately familiar with C, and then move on to the advanced concepts and
features that C++ provides once you want/need to use them.

--
Matt Emmerton

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Newbie: The C / C++ Issue

2003-11-11 Thread Lucas Holt
On Nov 11, 2003, at 9:06 PM, Alex Kelly wrote:

Thanks for all of the great suggestions to my previous question!

Yet, the responses have led me to another question. If C++ is newer 
and more advanced than C, will it replace C? If so, should I learn C++ 
and forget C?

Alex
___
It hasn't yet.  C++ and C are used by different types of people for 
different things.  If you want to write applications in Windows or Unix 
environments, C++ will work great for you.  If you want to write kernel 
level stuff, C would be the choice.  If you want to write Mac OS X 
apps, Objective C is the answer (but C would work too with Carbon).

A few more points:
The C programming Language AKA KR is partly authored by Dennis 
Ritchie.  He wrote the language.  That is THE book.  Buy it and another 
book if you want to learn C.

The C++ programming language is also written by the author of the 
language.  Its a good reference, but you can't learn C++ with it.  You 
need more books.  I have the C++ o'rielly book and its good, but lacks 
decent info on Object oriented programming.  I'd recommend Absolute C++ 
along with it to get the basics and then buy the C++ programming 
language if you really get into it.

As for what language to learn, I can tell you that C is very helpful 
when learning C++ and Objective C.  I took a course on C last year and 
its helped greatly with the C++ course I'm taking now.  I understand 
where things come from in C++.  I must say that C++ is easier than C in 
my view as i get Object oriented programming to some degree from VB and 
Java work i've done.  I'm also starting to learn objective C (the 
competitor to C++) so that I can utilize my Macintosh as a development 
platform.  The reason apple used objective C was because Mac OS X is 
really Nextstep which was written in like 1988 or so.

C is not useless when trying to learn C++, although they are different. 
 I do think of C++ as a superset of C, although as someone pointed out 
not a perfect one.  Fans of each language prefer the model of 
programming associated with them.  A C++ programmer almost always like 
object oriented design.  C programmers like structured programming.  
Find out which you like and go that route.

Lucas Holt
[EMAIL PROTECTED]

FoolishGames.com  (Jewel Fan Site)
JustJournal.com (Free blogging)
Only two things are infinite, the universe and human stupidity, and 
I'm not sure about the former.
- Albert Einstein (1879-1955)

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Newbie: The C / C++ Issue

2003-11-11 Thread Lucas Holt
You can't learn C++ without learning C first.  So I'd suggest you 
become
intimiately familiar with C, and then move on to the advanced concepts 
and
features that C++ provides once you want/need to use them.

--
Matt Emmerton
Thats not entirely accurate.  Western Michigan University only teaches 
C++, and i can tell you that most C topics like pointers and printf 
have never come up in class.  C style strings are it, and they didn't 
even explain those.  This is a common misconception.

you can go your whole life without
printf
only using
cout  hello world  endl;
Lucas Holt
[EMAIL PROTECTED]

FoolishGames.com  (Jewel Fan Site)
JustJournal.com (Free blogging)
Only two things are infinite, the universe and human stupidity, and 
I'm not sure about the former.
- Albert Einstein (1879-1955)

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Newbie: The C / C++ Issue

2003-11-11 Thread Scott W
Alex Kelly wrote:

Thanks for all of the great suggestions to my previous question!

Yet, the responses have led me to another question. If C++ is newer and more advanced than C, will it replace C? If so, should I learn C++ and forget C?

Alex
 

Again, it depends on WHAT you'd like to program.  That isn't to say you 
CAN'T program a specific type of application in language X, but some 
languages lend themselves to different tasks better.

C++ was supposed to 'replace C' since the 80s or so.  It's become more 
predominant for applications than C in _most_ cases, but the core OS of 
*bsd, Solaris, HP-UX, AIX, etc etc are all C.  Device drivers are 
written in C.  A large number of system daemons/services are written in 
C.  And yeah, because C lets you 'do as you want,' there are also some 
buggy C programs out there ;-) 

C++ may be a bit much if it's your first programming language.  There 
are things in CC++ that are ambiguous, moreso than in C- like the number 
of possible uses for the keyword 'const' among others ($^#*), and STL 
can be a _handful_ if you've never learned how to 'roll your own' data 
structures.  C pointers are at the same time a wonderful thing and a 
PITA to deal with at times.  C++ is generally MUCH fmore suited to GUI 
programming, and a few other tasks...but:

If you learn C first, and become competent at it, when/if you move on to 
another language, you'll have a better understanding of what's going on 
even if the 'next language' hides significantly more from you and makes 
your life easer (less coding, more use of libraries, foundation classes, 
STL, etc).

It's also not a terrible thing to learn C, and then ease into C++ simply 
as a 'better C'- stronger type checking, warnings that are now errors, 
and if pointers freaked you out TOO badly in C, you can then breathe a 
sign of relief and 'cheat' and use some of the functionality of C++ like 
references..

If you DO go that route (C first), it's likely you'll be a better 
programmer in the end, seriously- starting with C++ can be like trying 
to run before you realize you have feet, and can result in 'knowing' 
C++, but writing code that no one in their right mind wants to touch.. 
starting in Java is akin to someone being shown how to fly, but not 
knowing how to land, or turn, or much else ;-)  Possibly not the best 
phrasing, but I've met MANY programmers that are very good at one 
specific thing, but put them even slightly out of their element (like 
umm, take Java away from them and make them use a 'real' language!) and 
they're extremely confused- mention POSIX system calls and they go blank...

The best thing I can suggest, which I do myself when I try to _force_ 
myself to get Java more solidly into my skillset, is to first learn 'a 
bit.'  Go through one of the recommended books (and BTW, whoever said 
Eckel's TIC++, yep, good call, missed that one although it's on all of 
my systems HDs :-)  and DO the excercises.  Pace yourself, especially 
while learning, and don't think 'you know that already' and skip over 
excercises and questions, no matter how inane some of them may seem ;-)  
Then, pick a 'real' project you'd like to do, starting reasonably small, 
maybe a small part of a larger project...or pick up Steven's APUE and 
write a talk daemon and client or something similaryou'll find 
things that you thought you knew that you realize you have no idea 
about.  One of the niceties of *nix are the man pages- if you're looking 
for a specific function (in the standard C library or system calls), try:

man -k subject where subject is a single word, like:
man -k open
will return a LOT of summaries of man pages with their headers including 
the word 'open.'  man man or man intro to get info on limiting them 
further, but you'll find youself using man pages a LOT while you go 
through your project, whatever it is.  Complete the first one, whatever 
it is, and then pick up the next book, then go a bit more ambitious, and 
use what you've got so far along with what should now be more 
'reference' books than 'teaching books' and keep goinguse the force, 
Luke ;-)

Ok, I'll shaddup now... Did you catch the subtle hint in there to start 
with C? ;-)

Scott

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Newbie: The C / C++ Issue

2003-11-11 Thread Louis LeBlanc
On 11/11/03 09:26 PM, Matthew Emmerton sat at the `puter and typed:
  Thanks for all of the great suggestions to my previous question!
 
  Yet, the responses have led me to another question. If C++ is
  newer and more advanced than C, will it replace C? If so, should I
  learn C++ and forget C?

C++ will NEVER replace C.  Not gonna happen.  C compiles to much more
efficient code in many cases because of the template constructs in
C++.  If you can avoid templates at all costs, you get very close, and
only a few cases will cause slower code in C++.  However, when it
comes to operating systems, I suspect it will be a long time before
people start using something besides C.

 You can't learn C++ without learning C first.  So I'd suggest you
 become intimiately familiar with C, and then move on to the advanced
 concepts and features that C++ provides once you want/need to use
 them.

I think it was established in the previous thread that this was
definitely NOT the case.  In fact, I learned C++ before I learned C.

That isn't to say you can become a real C++ expert without learning C,
so while I disagree with the statement that C is a prerequisite of
C++, I agree that becoming intimately familiar with C first is a very
good idea.  I found the underlying basics of C much easier to grasp
than C++, so learning C first might have made C++ easier.

In addition, regardless of the fact that C++ is not quite a superset
of C, there are still times when it will be worthwhile, usually for
the sake of efficiency, to bypass the C++ standard constructs and
build your own using more of a 'clean C' approach.

Lou
-- 
Louis LeBlanc   [EMAIL PROTECTED]
Fully Funded Hobbyist, KeySlapper Extrordinaire :)
http://www.keyslapper.org ԿԬ

Zymurgy's Law of Volunteer Labor:
  People are always available for work in the past tense.
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Newbie: The C / C++ Issue

2003-11-11 Thread Robin Schoonover
On Tue, 11 Nov 2003 22:02:53 -0500, Lucas Holt [EMAIL PROTECTED]
wrote:
 
  You can't learn C++ without learning C first.  So I'd suggest you
  become intimiately familiar with C, and then move on to the advanced
  concepts and features that C++ provides once you want/need to use them.
  
  --
  Matt Emmerton

 Thats not entirely accurate.  Western Michigan University only teaches 
 C++, and i can tell you that most C topics like pointers and printf 
 have never come up in class.  C style strings are it, and they didn't 
 even explain those.  This is a common misconception.

Pretty much everything in the base language of C is in C++.  This includes
pointers, so you probably didn't learn C++ completely.  printf however, is
part of one of the C standard libraries (stdio in this case), not the
language itself and not C++ at all (not sure if C++ has variable arg
lists though).

 you can go your whole life without
 printf
 only using
 cout  hello world  endl;

Depends on what you plan on doing in your entire life.  A simple program
written in C probably would have to use printf.  Anything in the kernel
won't use cout, and even things you would expect in your standard C
enviroment have to be specially written for the kernel anyway.  And anyway,
most pople could go their entire life without cout.

Plus, cout may be easier to use for simple things like printing out numbers
and strings, but if you want your strings formatted, cout isn't much fun. 

I'd suggest learning C, and then if you have to, learn C++.

-- 
Robin Schoonover (aka End)
#
# Free Speech!! While Supplies Last!!  -- [EMAIL PROTECTED]
#
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Newbie: The C / C++ Issue

2003-11-11 Thread Alexander Franco


Thanks for all of the great suggestions to my previous question!

Yet, the responses have led me to another question. If C++ is newer 
and

Bahh.  Just jump straight into C# and you will avoid all those doubts.

just kidding ;)

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]