Previous in Forum: Order program   Next in Forum: PWM Program in C Language
Close
Close
Close
9 comments
Rate Comments: Nested
Active Contributor

Join Date: Jan 2008
Posts: 10

c and cpp language

01/25/2008 4:50 AM

what are the differences between c and c++?

Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.
Guru
Engineering Fields - Instrumentation Engineering - New Member Hobbies - Fishing - New Member

Join Date: Jan 2008
Location: Kazakhstan
Posts: 753
Good Answers: 8
#1

Re: c and cpp language

01/25/2008 6:57 AM

Generally C is subclass of C++. C is not support (directly) program classes. C is more suitable for relatively low-level system programming.

Any one here can write a lot about. I suppose you can find answer independently at public library or over web.


Your ques looks like school home work.

Register to Reply
The Architect
Engineering Fields - Software Engineering - S/W Architect Popular Science - Evolution - Fascinating! Fans of Old Computers - TRS-80 - A fine computer United States - US - Statue of Liberty - NY

Join Date: Dec 2004
Location: GlobalSpec, Troy NY
Posts: 386
Good Answers: 5
#2
In reply to #1

Re: c and cpp language

01/25/2008 8:43 AM

I wouldn't necessarily say that C is more suitable that C++ for low-level system programming... C++ essentially translates into C before it is compiled, so they will both get you as close to the "bare metal" as you want to go.

__________________
Mark Gaulin
Register to Reply
Guru
Engineering Fields - Instrumentation Engineering - New Member Hobbies - Fishing - New Member

Join Date: Jan 2008
Location: Kazakhstan
Posts: 753
Good Answers: 8
#3
In reply to #2

Re: c and cpp language

01/25/2008 8:57 AM

Not always this translation result goes smooth for concrete "iron". So I used to treat just clear C notation directly for downloading to controller. But I agree with you, for ideal cases it should be so. I am not devoted programmer as I suppose you are. My respect and kind regards.

Register to Reply
The Architect
Engineering Fields - Software Engineering - S/W Architect Popular Science - Evolution - Fascinating! Fans of Old Computers - TRS-80 - A fine computer United States - US - Statue of Liberty - NY

Join Date: Dec 2004
Location: GlobalSpec, Troy NY
Posts: 386
Good Answers: 5
#5
In reply to #3

Re: c and cpp language

01/25/2008 12:12 PM

In this case I will defer to you because you've actually seen problems (whereas I thinking about it more academically, which counts for very little where you actually need to get something done).

__________________
Mark Gaulin
Register to Reply
Guru
Engineering Fields - Instrumentation Engineering - New Member Hobbies - Fishing - New Member

Join Date: Jan 2008
Location: Kazakhstan
Posts: 753
Good Answers: 8
#7
In reply to #5

Re: c and cpp language

01/25/2008 12:36 PM

It's ok. Everyone has own experience and I agree with you again that for most default cases c++ is quite suitable for low-level application (OSs). Simply so often we have own thinking background and suppose naively that everybody has the same. Under low-level programming I've meant for instance Atmel 51 chip either ICP-DAS 7188 controller both more fitted be C codded for small memory model. All roads are crossed-in-assembler at all.

Register to Reply
Commentator

Join Date: Sep 2006
Location: Troy, NY
Posts: 86
Good Answers: 5
#4

Re: c and cpp language

01/25/2008 11:19 AM

Among the many differences, some of the big ones are:

1. C++ was built from C, to define an object-oriented language. The closest you can get to creating objects in C is using Structs, which only define member variables; while in C++, you can define member variables and member functions. A lot can be said about OO here...

2. C requires that you manage your own memory, while C++ can do most of this for you, automatically.

3. Handling of pointers is simplified in C++.

In essence, C is considered to be low-level and C++ is more high-level language. Java, which was built from C++, takes it one level higher by getting rid of the need for pointers, making programming less error-prone.

Register to Reply
The Architect
Engineering Fields - Software Engineering - S/W Architect Popular Science - Evolution - Fascinating! Fans of Old Computers - TRS-80 - A fine computer United States - US - Statue of Liberty - NY

Join Date: Dec 2004
Location: GlobalSpec, Troy NY
Posts: 386
Good Answers: 5
#6
In reply to #4

Re: c and cpp language

01/25/2008 12:14 PM

C++ does NOT automatically manage memory for you (but destructors help a bit), and I don't recall how pointer management was made any simplier in C++. Are you thinking of C# (which does both of those things?)

__________________
Mark Gaulin
Register to Reply
Guru
Engineering Fields - Instrumentation Engineering - New Member Hobbies - Fishing - New Member

Join Date: Jan 2008
Location: Kazakhstan
Posts: 753
Good Answers: 8
#8
In reply to #6

Re: c and cpp language

01/25/2008 1:01 PM

Friends! it's endless discussion. From machine code up to C, C++, Java etc we observe evolution vector goes from less abstract level of programming to greater. Java is working on virtually not existing "virtual machine" and eat computation resources that are believed more than enough. So nothing daunted. All should be paid. OO is great invention, but it can bring real nightmare especially facing deadline. But I do not blame OO. Everyone technology has own pluses and minuses. So I suggest to sum consensus for this topic --- C vs Cpp is the same as Pascal vs Delphi .

Register to Reply
Commentator

Join Date: Sep 2006
Location: Troy, NY
Posts: 86
Good Answers: 5
#9
In reply to #6

Re: c and cpp language

01/25/2008 7:29 PM

You're right...my mind must of got a late start this morning :)

I meant memory allocation, not management (like in Java and C#, as you said).

Also, I meant references, not pointers! Don't know what I was thinking

Register to Reply
Register to Reply 9 comments
Copy to Clipboard

Users who posted comments:

caramba (4); coonj (2); mgaulin (3)

Previous in Forum: Order program   Next in Forum: PWM Program in C Language

Advertisement