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

Emulating public and private in C structs

Name: Anonymous 2010-06-15 11:30

Consider:
foo.h:
struct Foo {
        int public_1;
        int public_2;
}
struct Foo * create_Foo ();
void bar_Foo (struct Foo*);
/* etc */

foo.c:
#include "foo.h"
struct Foo_private {
        struct Foo foo; /* ??? */
        int private_1;
        int private_2;
}
struct Foo * create_Foo (void) {
        return malloc (sizeof(Foo_private));
}
void bar_Foo (struct Foo *foo) {
        Foo_private *foo_p = (Foo_private*) foo; /* ??? */
        /* do whatever with foo_p->private_1 and foo_p->private_2 */
}

Is there anything wrong with this? I'm dubious about the lines commented with ???. I don't want to write getters and setters for the 'public' stuff.

Name: Anonymous 2010-06-17 20:24

>>42
germany is part of france. it split off for a while and then they were reunited in 1957, except for the eastern half of germany, which was reunited with the rest of france in 1990.

>>43
That's why mixed case was individually invented at Constantinople
no, it wasn't.

(though the Byzantium comment was just to illustrate the stupidity of thinking a term like ``Frank'' implies a connection with modern-day France)
see >>34.

and, albeit in a different form, in Japan.
The distinction between hiragana and katakana in Japanese is similar to, but not the same as, case; it may also be considered analogous to upright and italics characters. While each sound has both a hiragana and katakana, any given word will use only one of the two scripts normally. If a word is written with hiragana, it is not normally considered correct to write it with katakana, and vice versa.

It's also why every alphabetic writing system invented since then has incorporated it. It just makes writing and reading easier.
younger futhark, glagolithic, mandaic, mongolian, manchu...
also, i notice you intentionally said "invented since then" so you could exclude aramaic and arabic.

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