Re: OOP



campyhapper@xxxxxxxxx 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?

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.)

--
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
.



Relevant Pages

  • Re: OOP
    ... and of course I know that structs ... an object-oriented design. ... to C just a few key features and disallows things ... http://pitcher.digitalfreehold.ca/ | GPG public key available by request ...
    (comp.lang.c)
  • Re: OOP
    ... and of course I know that structs ... an object-oriented design. ... to C just a few key features and disallows things ... The language will work just as well. ...
    (comp.lang.c)
  • Re: which object orient language is most suitable for embedded programming?
    ... it boils down to using structs and passing pointers to the structure as the first parameter to your functions. ... That's possible, and provides better data hiding, but will cost you in run-time size and speed (unless you're program-at-once optimisations are spectacular). ... On a small micro, turning the index into an address for the struct is far from insignificant, especially if you don't have a fast multiplier, and it adds to the function call overhead you need for every single access. ... I did some timing tests when I adopted this kind of technique, on very lowly processors, and decided that the performance hit was worth the improvement in code cleanliness and readability. ...
    (comp.arch.embedded)
  • Re: OOP
    ... an object-oriented design. ... to C just a few key features and disallows things ... Keith Thompson kst-u@xxxxxxx ... Nokia ...
    (comp.lang.c)