Object-oriented programming in standard ANSI C

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • E. Robert Tisdale

    #31
    Re: Object-oriented programming in standard ANSI C

    Thierry Chappuis wrote:
    I'm interested in techniques used to program in an object-oriented way
    using the C ANSI language. I'm studying the GObject library and Laurent
    Deniau's OOPC framework published on his web site at
    http://ldeniau.web.cern.ch/ldeniau/html/oopc/oopc.html. The approach is
    very instructive. I know that I could do much of this stuff with e.g.
    C++, but the intellectual challenge of implementing these concepts with
    pure ANSI C is relevant to me.
    >
    Are you aware of another approaches? Any experience in using such
    techniques in production code? The use of GObject seems to be well
    implemented in the GNOME world, but I didn't find much about Laurent
    Deniau's OOPC. Have you some comments about the strengths and drawbacks
    of such techniques?
    Please find attached a C implementation
    of Bjarne Stroustrup's famous Shape class.

    C is not an object oriented programming language
    but you can write object oriented programs in C
    including programs that implement run-time polymorphism.
    The fprintf function on type *FILE is an example.
    You don't need a language translator or a special library.

    A program is not an object oriented programming language
    just because it is written in an object oriented programming language.
    All the popular object oriented programming languages are
    procedural programming languages first.
    An object oriented program must actually use
    the object oriented features of the language.
    Object oriented programming is first of all a programming style.

    The problem with C is that it does not directly support features
    such as inheritance and run-time polymorphism. Good C programmers
    have always used an object oriented programming style
    but implementing object oriented programs in C is problematic --
    tedious and error prone. The C++ programming language provides
    direct support for object oriented programming
    so it is much easier and more reliable.
    cat Point.h
    #ifndef GUARD_Point_h
    #define GUARD_Point_h 1

    typedef struct Point {
    // representation
    double X;
    double Y;
    } Point;
    // functions
    double
    Point_x(const Point* p);
    double
    Point_y(const Point* p);
    Point*
    Point_initializ e(Point* p, double x, double y);
    // constructors
    Point
    Point_createExp licit(double x, double y);
    Point
    Point_createDef ault(void);
    Point*
    Point_newExplic it(double x, double y);
    Point*
    Point_newDefaul t(void);
    // destructors
    void
    Point_destroy(c onst Point* p);
    void
    Point_delete(co nst Point* p);

    #endif // GUARD_Point_h
    cat Point.c
    // gcc -Wall -std=c99 -pedantic -I. -O2 -c Point.c

    #include<Point. h>
    #include<stdlib .h>

    // functions
    double
    Point_x(const Point* p) {
    return p->X; }
    double
    Point_y(const Point* p) {
    return p->Y; }
    Point*
    Point_initializ e(Point* p, double x, double y) {
    p->X = x;
    p->Y = y;
    return p;
    }
    // constructors
    Point
    Point_createExp licit(double x, double y) {
    Point p;
    Point_initializ e(&p, x, y);
    return p;
    }
    Point
    Point_createDef ault(void) {
    return Point_createExp licit(0.0, 0.0); }
    Point*
    Point_newExplic it(double x, double y) {
    Point* p = (Point*)malloc( sizeof(Point));
    Point_initializ e(p, x, y);
    return p; }
    Point*
    Point_newDefaul t(void) {
    return Point_newExplic it(0.0, 0.0); }
    // destructors
    void
    Point_destroy(c onst Point* p) { }
    void
    Point_delete(co nst Point* p) {
    Point_destroy(p );
    free((void*)p); }
    cat Color.h
    #ifndef GUARD_Color_h
    #define GUARD_Color_h 1
    typedef struct Color {
    // representation
    unsigned int R; // red
    unsigned int G; // green
    unsigned int B; // blue
    } Color;
    // functions
    unsigned int
    Color_red(const Color *c);
    unsigned int
    Color_green(con st Color *c);
    unsigned int
    Color_blue(cons t Color *c);
    Color*
    Color_initializ e(Color* c,
    unsigned int r,
    unsigned int g,
    unsigned int b);
    // constructors
    Color
    Color_createExp licit(
    unsigned int r,
    unsigned int g,
    unsigned int b);
    Color
    Color_createDef ault(void);
    Color*
    Color_newExplic it(
    unsigned int r,
    unsigned int g,
    unsigned int b);
    Color*
    Color_newDefaul t(void);
    // destructor
    void
    Color_destroy(c onst Color *c);
    void
    Color_delete(co nst Color *c);

    #endif // GUARD_Color_h
    cat Color.c
    // gcc -Wall -std=c99 -pedantic -I. -O2 -c Color.c

    #include<Color. h>
    #include<stdlib .h>

    // functions
    unsigned int
    Color_red(const Color *c) {
    return c->R; }
    unsigned int
    Color_green(con st Color *c) {
    return c->G; }
    unsigned int
    Color_blue(cons t Color *c) {
    return c->B; }
    Color*
    Color_initializ e(Color* c,
    unsigned int r,
    unsigned int g,
    unsigned int b) {
    c->R = r;
    c->G = g;
    c->B = b;
    return c;
    }
    // constructors
    Color
    Color_createExp licit(
    unsigned int r,
    unsigned int g,
    unsigned int b) {
    Color c;
    Color_initializ e(&c, r, g, b);
    return c; }
    Color
    Color_createDef ault(void) {
    return Color_createExp licit(0, 0, 0); }
    Color*
    Color_newExplic it(
    unsigned int r,
    unsigned int g,
    unsigned int b) {
    Color* c = (Color*)malloc( sizeof(Color));
    Color_initializ e(c, r, g, b);
    return c; }
    Color*
    Color_newDefaul t(void) {
    return Color_newExplic it(0, 0, 0); }
    // destructors
    void
    Color_destroy(c onst Color *c) { }
    void
    Color_delete(co nst Color *c) {
    Color_destroy(c );
    free((void*)c); }
    cat Shape.h
    #ifndef GUARD_Shape_h
    #define GUARD_Shape_h 1

    #include<Point. h>
    #include<Color. h>

    typedef struct Shape {
    // representation
    const
    void* V; // virtual function table pointer
    Point P;
    Color C;
    } Shape;
    // functions
    const Point*
    Shape_point(con st Shape* s);
    const Color*
    Shape_color(con st Shape* s);
    void
    actualShape_dra w(const Shape* s);
    double
    actualShape_are a(const Shape* s);
    void
    Shape_draw(cons t Shape* s); // virtual function
    double
    Shape_area(cons t Shape* s); // virtual function
    Shape*
    Shape_initializ e(Shape* s,
    const void* v,
    const Point* p,
    const Color* c);
    // constructors
    Shape
    Shape_createExp licit(
    const Point* p,
    const Color* c);
    Shape
    Shape_createDef ault(void);
    Shape*
    Shape_newExplic it(
    const Point* p,
    const Color* c);
    Shape*
    Shape_newDefaul t(void);
    // destructors
    void
    Shape_destroy(c onst Shape* s);
    void
    Shape_delete(co nst Shape* s);

    #endif // GUARD_Shape_h
    cat Shape.c
    // gcc -Wall -std=c99 -pedantic -I. -O2 -c Shape.c

    #include<stdio. h>
    #include<Shape. h>
    #include<stdlib .h>

    // functions
    const Point*
    Shape_point(con st Shape* s) {
    return &(s->P); }
    const Color*
    Shape_color(con st Shape* s) {
    return &(s->C); }
    void
    actualShape_dra w(const Shape* s) {
    fprintf(stderr, "Shape_draw(con st Shape*)\n");
    fflush(stderr); }
    double
    actualShape_are a(const Shape* s) {
    fprintf(stderr, "Shape_area(con st Shape*)\n");
    fflush(stderr);
    return 0.0; }

    typedef struct Shape_vtable_t {
    void (*Shape_draw)(c onst Shape*);
    double (*Shape_area)(c onst Shape*);
    } Shape_vtable_t;
    static const
    Shape_vtable_t
    Shape_vtable = {actualShape_dr aw, actualShape_are a};

    void
    Shape_draw(cons t Shape* s) { // virtual function
    ((Shape_vtable_ t*)(s->V))->Shape_draw(s ); }
    double
    Shape_area(cons t Shape* s) { // virtual function
    return ((Shape_vtable_ t*)(s->V))->Shape_area(s ); }
    Shape*
    Shape_initializ e(Shape* s,
    const
    void* v,
    const
    Point* p,
    const
    Color* c) {
    s->V = v;
    Point_initializ e(&(s->P), Point_x(p), Point_y(p));
    Color_initializ e(&(s->C), Color_red(c), Color_green(c), Color_blue(c));
    return s; }
    // constructors
    Shape
    Shape_createExp licitShape(
    const Point* p,
    const Color* c) {
    Shape s;
    Shape_initializ e(&s, (const void*)(&Shape_v table), p, c);
    return s; }
    Shape
    Shape_createDef ault(void) {
    Shape s;
    Point p = Point_createDef ault();
    Color c = Color_createDef ault();
    Shape_initializ e(&s, (const void*)(&Shape_v table), &p, &c);
    Color_destroy(& c);
    Point_destroy(& p);
    return s; }
    Shape*
    Shape_newExplic itShape(
    const Point* p,
    const Color* c) {
    Shape* s = (Shape*)malloc( sizeof(Shape));
    Shape_initializ e(s, (const void*)(&Shape_v table), p, c);
    return s; }
    Shape*
    Shape_newDefaul t(void) {
    Shape* s = (Shape*)malloc( sizeof(Shape));
    Point p = Point_createDef ault();
    Color c = Color_createDef ault();
    Shape_initializ e(s, (const void*)(&Shape_v table), &p, &c);
    Color_destroy(& c);
    Point_destroy(& p);
    return s; }
    // destructors
    void
    Shape_destroy(c onst Shape* s) {
    Color_destroy(S hape_color(s));
    Point_destroy(S hape_point(s));
    }
    void
    Shape_delete(co nst Shape* s) {
    Shape_destroy(s );
    free((void*)s); }
    cat Circle.h
    #ifndef GUARD_Circle_h
    #define GUARD_Circle_h 1

    #include<Shape. h>

    typedef struct Circle {
    Shape S; // public base class
    double R; // radius
    } Circle;
    // functions
    const Shape*
    Circle_shape(co nst Circle* c);
    double
    Circle_radius(c onst Circle* c);
    void
    actualCircle_dr aw(const Circle* c);
    double
    actualCircle_ar ea(const Circle* c);
    void
    Circle_draw(con st Circle* c); // virtual function
    double
    Circle_area(con st Circle* c); // virtual function
    Circle*
    Circle_initiali ze(Circle* c, const Shape* s, double r);
    // constructors
    Circle
    Circle_createDe fault(void);
    Circle
    Circle_createEx plicit(const Shape* s, double r);
    Circle*
    Circle_newDefau lt(void);
    Circle*
    Circle_newExpli cit(const Shape* s, double r);
    // destructors
    void
    Circle_destroy( const Circle* c);
    void
    Circle_delete(c onst Circle* c);

    #endif // GUARD_Circle_h
    cat Circle.c
    // gcc -Wall -std=c99 -pedantic -I. -O2 -c Circle.c

    #include<math.h >
    #include<stdio. h>
    #include<Circle .h>
    #include<stdlib .h>

    // functions
    const Shape*
    Circle_shape(co nst Circle* c) {
    return &(c->S); }
    double
    Circle_radius(c onst Circle* c) {
    return c->R; }
    void
    actualCircle_dr aw(const Circle* c) {
    fprintf(stderr, "Circle_draw(co nst Circle*)\n");
    fflush(stderr); }
    double
    actualCircle_ar ea(const Circle* c) {
    const
    double pi = 3.1415926535897 9323846;
    const
    double r = Circle_radius(c );
    fprintf(stderr, "Circle_area(co nst Circle*)\n");
    fflush(stderr);
    return pi*r*r; }

    typedef struct Circle_vtable_t {
    void (*Circle_draw)( const Circle*);
    double (*Circle_area)( const Circle*);
    } Circle_vtable_t ;
    static const
    Circle_vtable_t
    Circle_vtable = {actualCircle_d raw, actualCircle_ar ea};
    void
    Circle_draw(con st Circle* c) { // virtual function
    ((Circle_vtable _t*)(c->S.V))->Circle_draw(c) ;
    }
    double
    Circle_area(con st Circle* c) { // virtual function
    return ((Circle_vtable _t*)(c->S.V))->Circle_area(c) ;
    }

    Circle*
    Circle_initiali ze(Circle* c, const Shape* s, double r) {
    Shape_initializ e(&(c->S),
    (void*)(&Circle _vtable),
    Shape_point(s),
    Shape_color(s)) ;
    c->R = r;
    return c; }

    // constructors
    Circle
    Circle_createEx plicit(const Shape* s, double r) {
    Circle c;
    Circle_initiali ze(&c, s, r);
    return c; }
    Circle
    Circle_createDe fault(void) {
    Circle c;
    const
    Shape s = Shape_createDef ault();
    Circle_initiali ze(&c, &s, 0.0);
    Shape_destroy(& s);
    return c; }
    Circle*
    Circle_newExpli cit(const Shape* s, double r) {
    Circle* c = (Circle*)malloc (sizeof(Circle) );
    Circle_initiali ze(c, s, r);
    return c; }
    Circle*
    Circle_newDefau lt(void) {
    Circle* c = (Circle*)malloc (sizeof(Circle) );
    const
    Shape s = Shape_createDef ault();
    Circle_initiali ze(c, &s, 0.0);
    Shape_destroy(& s);
    return c; }
    // destructors
    void
    Circle_destroy( const Circle* c) {
    Shape_destroy(C ircle_shape(c)) ;
    }
    void
    Circle_delete(c onst Circle* c) {
    Shape_destroy(C ircle_shape(c)) ;
    free((void*)c); }
    cat main.c
    // gcc -Wall -std=c99 -pedantic -I. -O2 -o main main.c Circle.o Shape.o Color.o Point.o

    #include<stdio. h>
    #include<Circle .h>

    int
    main(int argc, char* argv[]) {
    const
    Shape s = Shape_createDef ault();
    const
    Circle c = Circle_createEx plicit(&s, 2.0);
    Shape_draw((con st Shape*)(&c));
    fprintf(stdout, "%g = radius\t %g = area\n",
    Circle_radius(& c), Shape_area((con st Shape*)(&c)));
    return 0;
    }
    cat Makefile
    CC=gcc
    DEFINES=
    INCLUDE=-I.
    OPTIONS=-Wall -std=c99 -pedantic -O2
    LIBRARY=
    OBJECTS=Point.o Color.o Shape.o Circle.o
    SOURCES=Point.c Color.c Shape.c Circle.c
    HEADERS=Point.h Color.h Shape.h Circle.h
    library=
    COMPILE=$(CC) $(DEFINES) $(INCLUDE) $(LIBRARY) $(OPTIONS)

    main: $(HEADERS) $(OBJECTS) main.c
    $(COMPILE) -o main main.c $(OBJECTS) $(library)

    Point.o: Point.h Point.c
    $(COMPILE) -c Point.c

    Color.o: Color.h Color.c
    $(COMPILE) -c Color.c

    Shape.o: Shape.h Shape.c
    $(COMPILE) -c Shape.c

    Circle.o: Circle.h Circle.c
    $(COMPILE) -c Circle.c

    clean:
    rm -f main $(OBJECTS)

    Comment

    • Roland Pibinger

      #32
      Re: Object-oriented programming in standard ANSI C

      On Fri, 17 Nov 2006 10:53:58 -0800, "E. Robert Tisdale" wrote:
      >Thierry Chappuis wrote:
      >I'm interested in techniques used to program in an object-oriented way
      >using the C ANSI language. of such techniques?
      >
      >Please find attached a C implementation
      >of Bjarne Stroustrup's famous Shape class.
      Your approach is similar to the results of my experiments with OO in
      C. You can increase encapsulation when you only forward declare your
      structs (e.g. struct Shape) in the header files. Also some functions
      (e.g. actualShape_dra w) can be removed form the header and made
      'private', i.e. static, in the respecive *.c file.

      Best regards,
      Roland Pibinger

      Comment

      • matevzb

        #33
        Re: Object-oriented programming in standard ANSI C

        There's a book/paper called "Object-Oriented Programming with ANSI-C"
        by Axel-Tobias Schreiner, available as a PDF at
        http://www.planetpdf.com/codecuts/pdfs/ooc.pdf. It explores this area
        to a great extend and I'd really recommend it.

        --
        WYCIWYG - what you C is what you get

        Comment

        • Roland Pibinger

          #34
          Re: Object-oriented programming in standard ANSI C

          On 17 Nov 2006 12:40:34 -0800, "matevzb" <matevzb@gmail. comwrote:
          >There's a book/paper called "Object-Oriented Programming with ANSI-C"
          >by Axel-Tobias Schreiner, available as a PDF at
          >http://www.planetpdf.com/codecuts/pdfs/ooc.pdf. It explores this area
          >to a great extend and I'd really recommend it.
          It's awful! IIRC, it needs AWK as preprocessor and uses mostly untyped
          void* pointers. IIRC, the book was never published in English because
          it found no publisher. Guess why.

          Regards,
          Roland Pibinger

          Comment

          • matevzb

            #35
            Re: Object-oriented programming in standard ANSI C

            It's awful! IIRC, it needs AWK as preprocessor and uses mostly untyped
            void* pointers.
            That was just my opinion and you don't have to agree. I found it
            useful, as it demonstrates what can be done in C. Void pointers can be
            dangerous, but then again, what would C be without them? =)
            (AWK is optional, depending on what you want to do)
            IIRC, the book was never published in English because
            it found no publisher. Guess why.
            Many books haven't been published in English. That doesn't mean they're
            bad books. (same goes for the authors)

            --
            WYCIWYG - what you C is what you get

            Comment

            • Chris Thomasson

              #36
              Re: Object-oriented programming in standard ANSI C

              "Thierry Chappuis" <thierry@mujigk a.chwrote in message
              news:1163586482 .468258.28770@i 42g2000cwa.goog legroups.com...
              Hi,
              >
              I'm interested in techniques used to program in an object-oriented way
              using the C ANSI language. I'm studying the GObject library and Laurent
              Deniau's OOPC framework published on his web site at
              http://ldeniau.web.cern.ch/ldeniau/html/oopc/oopc.html. The approach is
              very instructive. I know that I could do much of this stuff with e.g.
              C++, but the intellectual challenge of implementing these concepts with
              pure ANSI C is relevant to me.
              >
              Are you aware of another approaches?
              [...]

              Check this crap out:




              ;^)


              Comment

              • E. Robert Tisdale

                #37
                Re: Object-oriented programming in standard ANSI C

                Roland Pibinger wrote:
                Your approach is similar to the results of my experiments with OO in
                C. You can increase encapsulation when you only forward declare your
                structs (e.g. struct Shape) in the header files.
                Unfortunately, your approach precludes automatic function inlining.
                Also some functions (e.g. actualShape_dra w) can be removed form the header
                and made 'private', i.e. static, in the respecive *.c file.
                This would preclude any explicit call to function actualShape_dra w.
                An optimizing C++ compiler will elide the virtual {messenger} function
                and call the actual function directly
                if it can determine the actual type at compile time.

                ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
                http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
                ----= East and West-Coast Server Farms - Total Privacy via Encryption =----

                Comment

                • CBFalconer

                  #38
                  Re: Object-oriented programming in standard ANSI C

                  "E. Robert Tisdale" wrote:
                  >
                  .... snip ...
                  >
                  This would preclude any explicit call to function actualShape_dra w.
                  An optimizing C++ compiler will elide the virtual {messenger}
                  function and call the actual function directly if it can determine
                  the actual type at compile time.
                  This is c.l.c. comp.lang.c++ is thataway ------>

                  --
                  Chuck F (cbfalconer at maineline dot net)
                  Available for consulting/temporary embedded and systems.
                  <http://cbfalconer.home .att.net>

                  Comment

                  • Thierry Chappuis

                    #39
                    Re: Object-oriented programming in standard ANSI C

                    matevzb a écrit :
                    There's a book/paper called "Object-Oriented Programming with ANSI-C"
                    by Axel-Tobias Schreiner, available as a PDF at
                    http://www.planetpdf.com/codecuts/pdfs/ooc.pdf. It explores this area
                    to a great extend and I'd really recommend it.
                    >
                    --
                    WYCIWYG - what you C is what you get
                    Hi,

                    The Schreiner's approach uses heavy awk preprocessing, and too many
                    generic (void *) pointers. It is not the most convincing paper I've
                    read on the subject.

                    Thank you for your contribution

                    Thierry

                    Comment

                    • Thierry Chappuis

                      #40
                      Re: Object-oriented programming in standard ANSI C


                      Chris Thomasson a écrit :
                      "Thierry Chappuis" <thierry@mujigk a.chwrote in message
                      news:1163586482 .468258.28770@i 42g2000cwa.goog legroups.com...
                      Hi,

                      I'm interested in techniques used to program in an object-oriented way
                      using the C ANSI language. I'm studying the GObject library and Laurent
                      Deniau's OOPC framework published on his web site at
                      http://ldeniau.web.cern.ch/ldeniau/html/oopc/oopc.html. The approach is
                      very instructive. I know that I could do much of this stuff with e.g.
                      C++, but the intellectual challenge of implementing these concepts with
                      pure ANSI C is relevant to me.

                      Are you aware of another approaches?
                      >
                      [...]
                      >
                      Check this crap out:
                      >

                      Thank you for the link! Bookmarked!

                      Thierry

                      Comment

                      • Roland Pibinger

                        #41
                        Re: Object-oriented programming in standard ANSI C

                        On Fri, 17 Nov 2006 16:37:35 -0800, "E. Robert Tisdale" wrote:
                        >Roland Pibinger wrote:
                        >Your approach is similar to the results of my experiments with OO in
                        >C. You can increase encapsulation when you only forward declare your
                        >structs (e.g. struct Shape) in the header files.
                        >
                        >Unfortunatel y, your approach precludes automatic function inlining.
                        No encapsulation means no OO. You can't have both at the same time :-)
                        >Also some functions (e.g. actualShape_dra w) can be removed form the header
                        >and made 'private', i.e. static, in the respecive *.c file.
                        >
                        >This would preclude any explicit call to function actualShape_dra w.
                        >An optimizing C++ compiler will elide the virtual {messenger} function
                        >and call the actual function directly if it can determine the actual
                        >type at compile time.
                        But isn't polymorphism the point of the whole exercise?

                        Best regards,
                        Roland Pibinger

                        Comment

                        • E. Robert Tisdale

                          #42
                          Re: Object-oriented programming in standard ANSI C

                          Roland Pibinger wrote;
                          On Fri, 17 Nov 2006 16:37:35 -0800, "E. Robert Tisdale" wrote:
                          >Roland Pibinger wrote:
                          >>Your approach is similar to the results of my experiments with OO in
                          >>C. You can increase encapsulation when you only forward declare your
                          >>structs (e.g. struct Shape) in the header files.
                          >Unfortunatel y, your approach precludes automatic function inlining.
                          >
                          No encapsulation means no OO. You can't have both at the same time :-)
                          You probably meant "data hiding".
                          The C computer programming language allows you to encapsulate data
                          [in a struct] but it doesn't support data hiding at all.
                          Using an opaque data types
                          (publishing a struct declaration without publishing it's definition)
                          precludes some compile time optimizations.
                          >>Also some functions (e.g. actualShape_dra w) can be removed form the header
                          >>and made 'private', i.e. static, in the respecive *.c file.
                          >This would preclude any explicit call to function actualShape_dra w.
                          >An optimizing C++ compiler will elide the virtual {messenger} function
                          >and call the actual function directly if it can determine the actual
                          >type at compile time.
                          >
                          But isn't polymorphism the point of the whole exercise?
                          Yes, but there is no reason
                          why that should preclude non-polymorphic applications.

                          ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
                          http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
                          ----= East and West-Coast Server Farms - Total Privacy via Encryption =----

                          Comment

                          • Keith Thompson

                            #43
                            Re: Object-oriented programming in standard ANSI C

                            "E. Robert Tisdale" <edwin@netwood. netwrites:
                            [...]
                            You probably meant "data hiding".
                            The C computer programming language allows you to encapsulate data
                            [in a struct] but it doesn't support data hiding at all.
                            It doesn't? At all?
                            Using an opaque data types
                            (publishing a struct declaration without publishing it's definition)
                            precludes some compile time optimizations.
                            Ah, so it *does* support data hiding.

                            --
                            Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
                            San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
                            We must do something. This is something. Therefore, we must do this.

                            Comment

                            • Richard Tobin

                              #44
                              Re: Object-oriented programming in standard ANSI C

                              In article <455ee7c7.64896 31@news.utanet. at>,
                              Roland Pibinger <rpbg123@yahoo. comwrote:
                              >No encapsulation means no OO.
                              No encapsulation mean no points from the B&D end of the OO cabal, but
                              who cares?

                              -- Richard
                              --
                              "Considerat ion shall be given to the need for as many as 32 characters
                              in some alphabets" - X3.4, 1963.

                              Comment

                              • Chris Thomasson

                                #45
                                Re: Object-oriented programming in standard ANSI C

                                "Thierry Chappuis" <thierry@mujigk a.chwrote in message
                                news:1163842634 .249736.140840@ h54g2000cwb.goo glegroups.com.. .
                                Chris Thomasson a écrit :
                                >>"Thierry Chappuis" <thierry@mujigk a.chwrote in message
                                >news:116358648 2.468258.28770@ i42g2000cwa.goo glegroups.com.. .
                                >Hi,
                                >I'm interested in techniques used to program in an object-oriented way
                                >using the C ANSI language.
                                [...]
                                >Are you aware of another approaches?
                                >
                                [...]
                                >
                                "Thierry Chappuis"
                                >>>Thank you for the link! Bookmarked!
                                No problem... The technique works very well, IMHO. Its a quick, clear and
                                clean method for supporting basic OO programming in pure ANSI C. I like it
                                better than C++ in some respects; I am a C/Assembly Language programmer at
                                heart...

                                ;^)


                                Comment

                                Working...