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

Pages: 1-

I don't get it.

Name: Anonymous 2010-07-23 16:33

What's wrong with my naming convention for types?


typedef struct {
  int a;
  int b;
} tPair;

Name: Anonymous 2010-07-23 16:47

>>1

It isn't a good one.

Name: Anonymous 2010-07-23 17:02

>>2
...can you also tell me why? Srsly, I don't get it.

Name: Anonymous 2010-07-23 17:10

typedef struct { void *car, *cdr; } cons;

Fixed.

Name: Anonymous 2010-07-23 17:13

srsly, I don't get it again.

Name: Anonymous 2010-07-23 17:15

>>1,3,5
You would probably have to explain what your naming convention actually is before anyone could comment.

Name: Anonymous 2010-07-23 17:16

Maybe you should ask the person who criticised it instead of expecting strangers to read their mind for you.

Name: Anonymous 2010-07-23 17:18

>>6
>>7
Srsly, I still don't get it.

Name: Anonymous 2010-07-23 19:08

Nothing, but why bother with typedef? struct pair { int a,b; };

Name: Anonymous 2010-07-23 19:17

>>9
Enjoy your unnecessary typing and your leaky abstractions.

Name: Anonymous 2010-07-23 23:17

typedef struct {
    int auto;
    int tune;
} tPain;

Name: Anonymous 2010-07-24 1:02

>>4
Did you mean:

struct cons {
  void *car;
  struct cons *cdr;
};
typedef struct cons cons;

Name: not >>4 2010-07-24 1:21

>>12

>>4 is actually accurate. Cons cells are just pairs of two arbitrary objects. Chains of cons cells such as yours form lists (and if they are terminated by a NIL symbol or end-of-list object (depends on language and if they are different), it's called a proper list). Improper lists or just any kind of pair usage is perfectly legitimate Lisp usage. >>12 maye be the case for ML or Haskell, but in dynamically typed languages , like most Lisps, >>4's definition is the one used.

Name: Anonymous 2010-07-24 1:21

>>12
Nope, there is nothing that says the cdr of a pair has to be a pair.

Name: Anonymous 2010-07-24 1:22

>>13,14
SPAWHBTC

Name: Anonymous 2010-07-24 2:07

>>14
Bah you're right. I still have problems with the typedef in >>4 though.

Name: Anonymous 2010-07-24 2:23

>>16
struct cons { void *car, *cdr; };, then. enjoy your leaking abstraction.

Name: Anonymous 2010-07-24 2:28

enjoy your
FYI, this is a signal to stop taking you seriously.

Name: Anonymous 2010-07-24 4:46

>>18
back to /b/, please.

Name: Anonymous 2010-07-24 6:55

>>12

typedef struct cons {
        void *car;
        struct cons *cdr;
} cons_t;


i don't like typedefs masking my types

Name: Anonymous 2010-07-24 7:05

>>20
What you mean like in >>12? They don't.

Name: Anonymous 2010-07-24 9:19

>>20
Please learn C.
typedef struct cons {
        void *car;
        struct cons *cdr;
} cons_t;
int main (void) {
        cons_t please, avoid, using, reserved, suffixes, in, type, names;
        cons compile, error;
        return 1;
}

Name: Anonymous 2010-12-17 1:27

Xarn is a bad boyfriend

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