Dan Sugalski:
# At 10:43 PM -0500 2/23/02, Josh Wilmes wrote:
# >So indent needs to be told about non-standard type
# (typedefs) to work best.
# >The problem is that some of the parrot code does this:
# >
# >#define CHARTYPE struct parrot_chartype_t
# >#define ENCODING struct parrot_encoding_t
# >#define STRING struct parrot_string_t
# >#define Parrot_CharType struct parrot_chartype_t *
# >#define Parrot_Encoding struct parrot_encoding_t *
# >#define Parrot_String struct parrot_string_t *
# >
# >I think the first three are intended to give shorter names
# for use inside
# >the core.  I'm not sure about the seocnd three, but I think they can
# >probably be converted to typedefs safely enough.
# >
# >So, what should be done about the first three?  If it's cool to have
# >shortcut names for types like that, may I propose that we
# make a header file
# >which is for use in-core only and does all those aliases in
# one place.  Then
# >I can parse that for indent's purposes.
#
# We should make the first three typedefs. (Well, OK, we should make
# them all typedefs) I thought they were already, which'd explain some
# of the interesting error messages I get at times.

        struct foo_t {
                int i;
        };

        typedef struct foo_t * FooPtr;
        typedef struct foo_t FOO;

        void bar(FooPtr);

        void bar(FOO *x) {
                x->i++;
        }

        int main() {
                FOO* x=malloc(sizeof(struct foo_t));

                x->i = -1;

                bar(x);

                return x->i;
        }

VC++ doesn't like stunts like that.  That's why I changed it to #define
the types instead.

--Brent Dax
[EMAIL PROTECTED]
Parrot Configure pumpking, regex hacker, embedding coder, and boy genius

#define private public
    --Spotted in a C++ program just before a #include

Reply via email to