Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

String or Char*

Name: Anonymous 2010-07-19 22:24

What does /prog/ like better?

I personally like string

Name: Anonymous 2010-07-20 9:56

>>5
You may as well have used C, then you'd only have added enough shit that amounts to how much shit the ++ adds on, instead of already having that amount of shit and then adding the same amount on again.

Name: Anonymous 2010-07-20 12:11

>>18
Nonsense. How is do_stuff(some_object, 1, 2, 3) significantly different than some_object.do_stuff(1, 2, 3)? You might as well use C and accomplish all the same things with less work.

Name: Anonymous 2010-07-20 12:41

>>20
Inheritance is messy anyway. But with a bit of standard boilerplate it really isn't any uglier than C++.

typedef struct parent {
    int a, b, c; /* some stuff */
} parent;
typedef struct child {
    parent p;
    int d, e;
} child;
/* ... */
#define PARENT(obj) ((parent *) (obj))
#define parent_do_stuff(obj, a, b, c) _parent_do_stuff(PARENT(obj), a, b, c)


Then your actual code looks something like:
child *c = new_child();
parent_do_stuff(c, 1, 2, 3);

No nasty casts all over the place like Gtk has. Note that you can toss something like int rtti in your parent object and contrive some sort of isa() to verify that the pointed object is of the appropriate type.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List