Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #60354

Re: Objects in C

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: Objects in C
Date 2015-04-18 15:41 -0700
Organization None to speak of
Message-ID <87twwdoy91.fsf@kst-u.example.com> (permalink)
References <14aac167-b724-458d-80f2-cc7a300e1ff3@googlegroups.com>

Show all headers | View raw


David Kleinecke <dkleinecke@gmail.com> writes:
> After all these years uncertainty still reigns about what 
> object-oriented computing is all about. I have my own opinions
> and this groups seems like a good place to present my techniques
> and, perhaps, get some useful feedback.
>
> I consider objects a good way to organize processes. I also
> prefer to code in C. By C I mean 1990 ANSI C. 

What's wrong with the later standards?

> By "class" I mean a pair of a struct type and a function. I
> would define them both in a .h file along with an optional
> enum. An object of the class is a variable of the struct type.
>
> Suppose I want to use foobar objects. To do this I declare
>    
>    typedef struct {...} FooBar;
>    void* foobar (int m, void* o, void* d);
>
> where m is a method number (perhaps defined by an enum), o
> is variable of type FooBar and d is additional data.

*Perhaps* defined by an enum?

> I prefer to clone variables. So I could call method 0 the 
> clone method and write
>
>    FooBar* fb = foobar (0, 0, 0);
>
> Where cloning 0 creates a default FooBar object.

So I have to remember that 0 means "clone" to be able to read your code?
No thanks.

> To inherit I just make a call to a parent class. To multiply
> inherit it is necessary to change the method numbers to
> inherit from all but one of the parent classes.
>
> Some things people insist on - like polymorphism - seem to
> me perhaps useful but easy to get along without. 
>
> Reactions ?
>  

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-18 10:26 -0700
  Objects in C asetofsymbols@gmail.com - 2015-04-18 10:54 -0700
    Objects in C asetofsymbols@gmail.com - 2015-04-18 11:52 -0700
  Re: Objects in C Jens Stuckelberger <Jens_Stuckelberger@nowhere.net> - 2015-04-18 19:02 +0000
    Re: Objects in C BGB <cr88192@hotmail.com> - 2015-04-18 15:08 -0500
      Re: Objects in C BGB <cr88192@hotmail.com> - 2015-04-18 16:46 -0500
  Re: Objects in C Keith Thompson <kst-u@mib.org> - 2015-04-18 15:41 -0700
    Re: Objects in C August Karlstrom <fusionfile@gmail.com> - 2015-04-19 11:48 +0200
      Re: Objects in C BGB <cr88192@hotmail.com> - 2015-04-19 09:32 -0500
      Re: Objects in C Keith Thompson <kst-u@mib.org> - 2015-04-19 07:55 -0700
        Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-19 09:27 -0700
          Re: Objects in C Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-04-19 20:52 +0200
            Re: Objects in C BGB <cr88192@hotmail.com> - 2015-04-19 16:01 -0500
            Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-20 10:50 -0700
              Re: Objects in C Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-04-20 22:49 +0200
          Re: Objects in C Keith Thompson <kst-u@mib.org> - 2015-04-19 13:54 -0700
            Re: Objects in C Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-04-19 23:05 +0200
              Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-20 10:53 -0700
                Re: Objects in C Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-04-20 22:47 +0200
    Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-19 10:14 -0700
      Re: Objects in C raltbos@xs4all.nl (Richard Bos) - 2015-04-20 10:25 +0000
        Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-20 10:58 -0700
  Re: Objects in C Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-04-19 12:47 +0200
    Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-19 09:53 -0700
      Re: Objects in C Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-04-19 19:19 +0200
  Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-19 09:43 -0700
    Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-20 10:37 -0700
    Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-20 10:41 -0700
    Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-22 11:50 -0700
      Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-23 10:02 -0700
        Re: Objects in C Chad <cdalten@gmail.com> - 2015-04-23 11:12 -0700
          Re: Objects in C Chad <cdalten@gmail.com> - 2015-04-23 12:10 -0700
        Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-25 02:31 -0700
          Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-25 10:19 -0700
            Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-26 08:45 -0700
              Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-27 08:37 -0700
                Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-28 08:27 -0700
                Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-28 08:59 -0700
                Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-30 07:32 -0700
                Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-30 09:19 -0700
                Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-05-01 04:21 -0700
                Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-05-01 10:37 -0700
                Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-05-03 10:54 -0700
                Re: Objects in C "Chris M. Thomasson" <cristom@charter.net> - 2015-05-03 12:19 -0700
                Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-05-03 13:45 -0700
                Re: Objects in C "Chris M. Thomasson" <cristom@charter.net> - 2015-05-03 13:58 -0700
                Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-05-05 05:56 -0700
                Re: Objects in C "Chris M. Thomasson" <cristom@charter.net> - 2015-05-06 16:09 -0700
                Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-05-06 19:30 -0700
                Re: Objects in C "Chris M. Thomasson" <cristom@charter.net> - 2015-05-03 14:02 -0700
                Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-05-04 12:21 -0700
                Re: Objects in C "Chris M. Thomasson" <cristom@charter.net> - 2015-05-06 16:39 -0700
                Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-05-07 12:59 -0700
                Re: Objects in C "Chris M. Thomasson" <cristom@charter.net> - 2015-05-09 12:42 -0700
                Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-05-10 11:15 -0700
          Re: Objects in C luser droog <luser.droog@gmail.com> - 2015-04-25 13:37 -0700
            Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-26 07:13 -0700
              Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-26 08:40 -0700
                Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-28 08:23 -0700
            Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-26 08:07 -0700
  Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-19 10:13 -0700
  Re: Objects in C "Chris M. Thomasson" <cristom@charter.net> - 2015-04-20 12:49 -0700
    Re: Objects in C "Chris M. Thomasson" <cristom@charter.net> - 2015-04-23 16:13 -0700
      Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-24 09:58 -0700
        Re: Objects in C "Chris M. Thomasson" <cristom@charter.net> - 2015-04-24 19:14 -0700
        Re: Objects in C "Chris M. Thomasson" <cristom@charter.net> - 2015-04-25 22:13 -0700
          Re: Objects in C David Kleinecke <dkleinecke@gmail.com> - 2015-04-26 08:40 -0700
  Re: Objects in C Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-22 11:44 -0700

csiph-web