OOP

C

campyhapper

Hi folks,

I tend to prefer C, and of course I know that structs
can be used in C to achieve something like
an object-oriented design. And I prefer C in part
because C++ has, I think, grown into a bit of a
monster wherein readability is sacrificed.
But I wonder, has anyone ever tried to create a
sort of lite version of C++, a C+ if you will, that adds
to C just a few key features and disallows things
like templates, multiple inheritance and the like?

Thanks.
 
C

Charlton Wilbur

ch> But I wonder, has anyone ever tried to create a sort of lite
ch> version of C++, a C+ if you will, that adds to C just a few key
ch> features and disallows things like templates, multiple
ch> inheritance and the like?

C++ has a philosophy of not making you pay for language features you
don't use. Use C++, but don't use the features you don't like.

Charlton
 
C

campyhapper

Yes. It never works very well. If that's what you want, just use C++ and
discipline yourself not to use the features that you think hamper
readability. (That is what I already do in C. The fact that goto, say, is
available does not mean that I am required to use it.)

You have a point. And I know that nothing I do or say
will stop others from using C++'s problematic features
or even its good features in bad ways.

But an analogy might be that C is like a car,
C++ is like a motorcycle. Accidents happen
more readily with motorcycles and with C++.
And although I'm a careful driver of all vehicles,
and a careful coder, chances are higher that,
if I say to an employer "I'm a C++ programmer"
they will stick me with someone else's C++ code
that is incomprehensible than if I say I'm
a C programmer.
 
K

Keith Thompson

I tend to prefer C, and of course I know that structs
can be used in C to achieve something like
an object-oriented design. And I prefer C in part
because C++ has, I think, grown into a bit of a
monster wherein readability is sacrificed.
But I wonder, has anyone ever tried to create a
sort of lite version of C++, a C+ if you will, that adds
to C just a few key features and disallows things
like templates, multiple inheritance and the like?

There have been a number of such attempts. As far as I know, no two
of them agree on which features are vital and which should be
discarded.
 
S

santosh

Hi folks,

I tend to prefer C, and of course I know that structs
can be used in C to achieve something like
an object-oriented design. And I prefer C in part
because C++ has, I think, grown into a bit of a
monster wherein readability is sacrificed.
But I wonder, has anyone ever tried to create a
sort of lite version of C++, a C+ if you will, that adds
to C just a few key features and disallows things
like templates, multiple inheritance and the like?

Here's your cue Jacob. :)
 
L

Lew Pitcher

In said:
Hi folks,

I tend to prefer C, and of course I know that structs
can be used in C to achieve something like
an object-oriented design. And I prefer C in part
because C++ has, I think, grown into a bit of a
monster wherein readability is sacrificed.
But I wonder, has anyone ever tried to create a
sort of lite version of C++, a C+ if you will, that adds
to C just a few key features and disallows things
like templates, multiple inheritance and the like?

The original cfront "C with Classes" C++ translator was last updated in
January 2007. Perhaps cfront would provide you with the C++ features you
wish while still maintaining the straightforwardness of C. If you are
interested, you can take a look at version 3.3 at
http://www.softwarepreservation.org/projects/c_plus_plus/cfront

--
Lew Pitcher

Master Codewright & JOAT-in-training | Registered Linux User #112576
http://pitcher.digitalfreehold.ca/ | GPG public key available by request
---------- Slackware - Because I know what I'm doing. ------
 
K

Kaz Kylheku

But I wonder, has anyone ever tried to create a
sort of lite version of C++, a C+ if you will, that adds
to C just a few key features and disallows things
like templates, multiple inheritance and the like?

Yes. Bjarne Stroustrup did this (around 1981, IIRC) and called it ``C
with classes''. It translated a C-like language with OOP features into
C. This evolved into C++.
 
C

campyhapper

The original cfront "C with Classes" C++ translator was last updated in
January 2007.

Right but who uses it? And if I'm going to turn back the clock, I
might as well go with Objective C.
 
S

Sjouke Burry

Hi folks,

I tend to prefer C, and of course I know that structs
can be used in C to achieve something like
an object-oriented design. And I prefer C in part
because C++ has, I think, grown into a bit of a
monster wherein readability is sacrificed.
But I wonder, has anyone ever tried to create a
sort of lite version of C++, a C+ if you will, that adds
to C just a few key features and disallows things
like templates, multiple inheritance and the like?

Thanks.
Why not just use the features you want and ignore the
ones you dont like??
The language will work just as well.
 
R

Roberto Waltman

... has anyone ever tried to create a
sort of lite version of C++, a C+ if you will, that adds
to C just a few key features and disallows things
like templates, multiple inheritance and the like?

See Embedded C++:
http://www.caravan.net/ec2plus/

As others pointed out already, it is not better than restricting
yourself to a subset of the language.
(Unless you are implementing a compiler for that subset.)
 
S

Sean G. McLaughlin

And if I'm going to turn back the clock, I
might as well go with Objective C.

That is a fairly ignorant statement about Objective-C. There is
nothing "out-of-date" about it, or perhaps you've never heard of Mac OS X
(they just came out with a new point release)?

And despite your dismissal of it, ObjC fulfills your description of the
language you want precisely:
and disallows things like templates, multiple inheritance and the like?
Check. No templates and MI is explicitly disallowed.
 
C

campyhapper

And despite your dismissal of it, ObjC fulfills your description of the
language you want precisely:


Check.  No templates and MI is explicitly disallowed.

I was being sarcastic. I didn't mean to disrespect your beloved
language and hurt your tender feelings. I am quite ashamed of my
heartless conduct in ever so slightly diminishing ObjC's shimmering
and glistening vitality, which is like a newly formed fine ocean
spray, even while Apple's ObjC libraries are largely the intellectual
property of Apple(TM) Computer, (R) Inc., destroyer of ThinkSecret and
eviscerater of select iPhone-clone retailers, and are therefore off-
limits like a dank moss-covered basement reeking of urine.
 
R

rahul

Hi folks,

I tend to prefer C, and of course I know that structs
can be used in C to achieve something like
an object-oriented design. And I prefer C in part
because C++ has, I think, grown into a bit of a
monster wherein readability is sacrificed.
But I wonder, has anyone ever tried to create a
sort of lite version of C++, a C+ if you will, that adds
to C just a few key features and disallows things
like templates, multiple inheritance and the like?

Thanks.

Why do you want a new lang. if what you want is really a subset of C+
+? May be implementing object oriented concepts in C itself will solve
your purpose. (As pete demonstrated)
 
C

campyhapper

Why do you want a new lang. if what you want is really a subset of C+
+? May be implementing object oriented concepts in C itself will solve
your purpose. (As pete demonstrated)

That's what I usually do, and I've had success with that,
although it's like reinventing the wheel for every project.
There may come a day when I will just release my
"classes" for general consumption and see if they
gain any traction.

Or, I will just switch to Objective C.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top