473,804 Members | 3,526 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is necessary to switch to C++ or some object-oriented language?

Hi fellows,

I am reading some books to learn the C programming language, and
sometimes I have the feeling that when somebody becomes a C expert, he
must learn a more modern and object-oriented language.

When I read things like "... C++ is an evolution of C ..." or "... C
is a subset of C++ ..." I tend to believe that I will have to learn C+
+ sooner or later. It sounds like C++ is the future and C is the past
(and will be no longer useful anytime soon).

And how about the other object-oriented language: Java. They say it is
very powerful and it seems to be everywhere.

So, I started to ask myself...

Is object-oriented better?
Is necessary to switch to C++ or some object-oriented language?
Is it true that C tends to be decreasingly used?
And finally ... why do people need object-oriented languages?

I am sorry for making so many questions.

Thank you all,

Arnaldo

Mar 21 '07
46 3037
"user923005 " <dc*****@connx. comwrites:
On Mar 21, 1:38 pm, rpbg...@yahoo.c om (Roland Pibinger) wrote:
>On 21 Mar 2007 01:24:56 -0700, "arnuld" wrote:
>On Mar 21, 10:18 am, ajb...@gmail.co m wrote:
or "... C is a subset of C++ ..."
>complete NON-SENSE

Syntacticall y, C is a subset of C++ with minor exceptions. This fact
was the main reason for C++'s initial success.

Even Bjarne Stroustrup has admitted that this claim is false.
C is not a subset of C++ with minor exceptions.
But would you deny that C++'s close relationship to C had an
effect on its initial success? My guess is that this is a true
statement, although I'm no scholar of C++ history.
--
"What is appropriate for the master is not appropriate for the novice.
You must understand the Tao before transcending structure."
--The Tao of Programming
Mar 21 '07 #21
"Ben Pfaff" <bl*@cs.stanfor d.eduwrote in message
>
But would you deny that C++'s close relationship to C had an
effect on its initial success? My guess is that this is a true
statement, although I'm no scholar of C++ history.
I think the name was a big factor.
Most people would ignore "C with classes" because they last needed classes
back in high school. However to admit you don't know a language called C++
is to brand yourself a person--. So it caught on.

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

Mar 21 '07 #22

"Charlton Wilbur" <cw*****@chroma tico.netwrote in message
>
Surely you aren't relegating Lisp, COBOL, and FORTRAN to the dustbin
of history?
I've just spent the last three days translating a Fortran 77 routine to C.
It was a long routine. The C version will probably run slower, but it will
be easier to try out different algorithms to speed it up, and it can take
inputs of arbitrary size. F77 doesn't have a malloc().
--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

Mar 21 '07 #23
<aj****@gmail.c omwrote in message
Is object-oriented better?
Is an axe better than a saw? You can use either for a lot of jobs, but most
people would dismiss the question as meaningless.
>
Is necessary to switch to C++ or some object-oriented language?
It is necessary to know an object-oriented language if you wish to be an
adequately skilled programmer. In practise that means either Java or C++.
You should also understand where not to use object-oriented design.
>
Is it true that C tends to be decreasingly used?
More and more languages are coming out and that is inevitably having an
effect on C's market share. However none look like displacing C as the
default lanauge for serious programming.
>
And finally ... why do people need object-oriented languages?
To do object-oriented design. Though it is possible to implement object
hierarchies in any language, including C, it is so messy as to be unusable.
If you are asking why do object-oriented design, if you want your program to
be extended by a third party in ways unforseen by you, but without any
changes to your source code, objects offer by far the easiest way to do
this. For instance a space invader may travel a path specified by a "line"
object. A line has certain properties, namely that it has a length, and x, y
coordinates given by a t value. Any object supporting the interface "line"
can be passed to the space invader control, including really odd lines such
as the programmer's name in Arabic.

More controversially , object-oriented desings may be easier to test, debug
and maintain than procedural ones. Personally I am sceptical, but it is
received wisdom.

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

Mar 21 '07 #24
On 21 Mar 2007 14:14:26 -0700, "user923005 " wrote:
>Even Bjarne Stroustrup has admitted that this claim is false.
C is not a subset of C++ with minor exceptions.
'How close is "as close as possible to C?" Traditionally, it has
almost been possible to equate that statement with "compatible with C
except where the C++ type system would be compromised." '

http://www.research.att.com/~bs/siblings_short.pdf
Mar 21 '07 #25
On Mar 21, 3:29 pm, rpbg...@yahoo.c om (Roland Pibinger) wrote:
On 21 Mar 2007 14:14:26 -0700, "user923005 " wrote:
Even Bjarne Stroustrup has admitted that this claim is false.
C is not a subset of C++ with minor exceptions.

'How close is "as close as possible to C?" Traditionally, it has
almost been possible to equate that statement with "compatible with C
except where the C++ type system would be compromised." '

http://www.research.att.com/~bs/siblings_short.pdf
/*
Where is the C++ tyep system compromised here:
*/
int main(void)
{
int new = 0;
return new;
}

Mar 21 '07 #26
On Mar 21, 3:29 pm, rpbg...@yahoo.c om (Roland Pibinger) wrote:
On 21 Mar 2007 14:14:26 -0700, "user923005 " wrote:
Even Bjarne Stroustrup has admitted that this claim is false.
C is not a subset of C++ with minor exceptions.

'How close is "as close as possible to C?" Traditionally, it has
almost been possible to equate that statement with "compatible with C
except where the C++ type system would be compromised." '

http://www.research.att.com/~bs/siblings_short.pdf
Having read the paper, I agree with it. I think this statement is
telling:

'The "as close as possible ..." rules were crafted under the
assumption that "the other language" was immutable. In reality, it has
not been so: Just look as the number of cross borrowings between C and
C++ [Stroustrup,2002].'

Mar 21 '07 #27
On Mar 21, 2:29 pm, Ben Pfaff <b...@cs.stanfo rd.eduwrote:
"user923005 " <dcor...@connx. comwrites:
On Mar 21, 1:38 pm, rpbg...@yahoo.c om (Roland Pibinger) wrote:
On 21 Mar 2007 01:24:56 -0700, "arnuld" wrote:
On Mar 21, 10:18 am, ajb...@gmail.co m wrote:
or "... C is a subset of C++ ..."
complete NON-SENSE
Syntactically, C is a subset of C++ with minor exceptions. This fact
was the main reason for C++'s initial success.
Even Bjarne Stroustrup has admitted that this claim is false.
C is not a subset of C++ with minor exceptions.

But would you deny that C++'s close relationship to C had an
effect on its initial success? My guess is that this is a true
statement, although I'm no scholar of C++ history.
Certainly not. On the other hand, I think that years of "Thinking in
C" made it harder for me to think in terms of objects. On the other,
other hand, I had years of Fortran and PL/I before C, and so my
handicap started further back.

The two languages have some syntatical similarities, but I would argue
that used properly, neither language really resembles the other at
all.
--
"What is appropriate for the master is not appropriate for the novice.
You must understand the Tao before transcending structure."
--The Tao of Programming

Mar 21 '07 #28
On Mar 21, 2:14 pm, "user923005 " <dcor...@connx. comwrote:
On Mar 21, 1:38 pm, rpbg...@yahoo.c om (Roland Pibinger) wrote:

Syntactically, C is a subset of C++ with minor exceptions. This fact
was the main reason for C++'s initial success.

Even Bjarne Stroustrup has admitted that this claim is false.
C is not a subset of C++ with minor exceptions.
I suppose it hinges on what you consider "minor", but please specify
why you consider this claim to be false. It's very rare for programs
to need to call main() recursively, or to care about the type of a
charater constant, for example. The need to cast void * to other
object pointer types is slightly more intrusive, but I'd still
consider it minor. Which are the non-minor exceptions?

Mar 22 '07 #29
On Mar 22, 4:21 am, "user923005 " <dcor...@connx. comwrote:
On Mar 21, 2:29 pm, Ben Pfaff <b...@cs.stanfo rd.eduwrote:
"user923005 " <dcor...@connx. comwrites:
On Mar 21, 1:38 pm, rpbg...@yahoo.c om (Roland Pibinger) wrote:
>On 21 Mar 2007 01:24:56 -0700, "arnuld" wrote:
>On Mar 21, 10:18 am, ajb...@gmail.co m wrote:
>or "... C is a subset of C++ ..."
>complete NON-SENSE
>Syntacticall y, C is a subset of C++ with minor exceptions. This fact
>was the main reason for C++'s initial success.
Even Bjarne Stroustrup has admitted that this claim is false.
C is not a subset of C++ with minor exceptions.
But would you deny that C++'s close relationship to C had an
effect on its initial success? My guess is that this is a true
statement, although I'm no scholar of C++ history.

Certainly not. On the other hand, I think that years of "Thinking in
C" made it harder for me to think in terms of objects. On the other,
other hand, I had years of Fortran and PL/I before C, and so my
handicap started further back.

The two languages have some syntatical similarities, but I would argue
that used properly, neither language really resembles the other at
all.
yes that is what *exactly* i meant

thanks "user------"

:-)

Mar 22 '07 #30

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
10913
by: Myster Ious | last post by:
Polymorphism replaces switch statements, making the code more compact/readable/maintainable/OO whatever, fine! What I understand, that needs to be done at the programming level, is this: a switch-case has a variable (most probably an enumeration) & associated symbols or integral value. Selection is made, base on what symbol/value the variable holds. So
13
7475
by: William Stacey | last post by:
Using the following code sample: public byte Get() { // <= Possible to switch Here?? lock(syncLock) { //Do something in Get(). } }
3
19743
by: pgraeve | last post by:
I am a convert from VB to C# so bear with me on this "conversion" question C# switch statement seems to be the closest relative to VB's Select Case. I used VB's Select Case statement liberally. Now I find myself wanting to use "Select Case" i.e., "switch" in C# regularly, but I always have to find another way b/c C#'s switch statement only allows static or integral variables. For example, I often want to use a switch statement based on the...
5
3692
by: Nadav | last post by:
Hi, I am using FileStream's Async API: BeginRead/EndRead, upon completion callback execution I use the read data and call EndRead, Taking that in mind, I Wonder... does calling EndRead will cause a context switch? What is the kernel object used for blocking EndRead calls? Event and mutex cause a context switch even when the object is signaled and no wait is needed, usage of critical section prevent this switch from happening... what is the...
16
19061
by: ME | last post by:
In C# the following code generates a compiler error ("A constant value is expected"): public void Test(string value) { switch (value) { case SimpleEnum.One.ToString(): MessageBox.Show("Test 1"); break;
13
4538
by: Fei Liu | last post by:
Hi Group, I've got a problem I couldn't find a good solution. I am working with scientific data files in netCDF format. One of the properties of netCDF data is that the actual type of data is only known at run time. Therefore a lot of template based trick isn't too useful. Considering datafile float x(3) 3.5, 2.5, 8.9 double y(3) 2.7, -2.3, 1.2 int z(3) 5, 2, 3
7
1999
by: cytec123187 | last post by:
Hello, I am working on an Adobe Acrobat file that uses javascript for calculations. I am trying to create a field that uses two other fields to determine a number value. I think this requires a switch within a switch, but I am not sure how to do this, as I am a beginner when it comes to javascript. In esscense, I want to set up a code so that each case of value A is calculated at each case of value B. Example:
2
6594
by: Angel Of Death | last post by:
I have a method. It takes some XML as a parameter. Depending on the content of the XML it should create a specific object and call a KNOWN method. So: public void PersistXml(string XmlData){} I then determine what object I should call the Persist method on using a switch statement (not very OO). switch (otype)
9
6284
by: Gordon | last post by:
I want to add a feature to a project I'm working on where i have multiple users set up on my Postgres database with varying levels of access. At the bare minimum there will be a login user who only has read access to the users table so that users can log in. Once a user has been logged in successfully I want to escalate that user's access level to one appropriate to their role, which will include switching the postgres user they are...
2
1462
by: Phillip B Oldham | last post by:
What would be the optimal/pythonic way to subject an object to a number of tests (based on the object's attributes) and redirect program flow? Say I had the following: pets = {'name': 'fluffy', 'species': 'cat', 'size': 'small'} pets = {'name': 'bruno', 'species': 'snake', 'size': 'small'} pets = {'name': 'rex', 'species': 'dog', 'size': 'large'}
0
9708
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10589
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10327
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3828
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2999
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.