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

int* p vs. int *p

Name: Anonymous 2009-10-29 0:18

What do you think about the difference between the following declarations? Which do you prefer?

int* p;
int *p;

It's often said the first is C++ style and the second is C style. I prefer C but conceptually the first declaration makes a lot more sense to me. You're defining a variable p of type int*. p is an int*. You dereference it, *p, when you want the int. Makes sense. The second example to me seems like gobbledygook, but it's the way the C authors thought of it, because of this bullshit:

int *p, *q;

So what the fuck is the deal? Can someone who uses "int *p" syntax explain to me what goes through your head when you write that garbage?

Name: Anonymous 2009-10-29 20:30


#include <stdio.h>
#define a(b) char*(b)(){return #b ;}
#define k z[(int)(x++)]
#define g(r) z[x-(r)]
char x=0,*(*z[0xa])();
a(d)
a(r)
a(w)
a(o)
a(l)
a(e)
a(h)
int main() { k=d;k=l;k=r;k=o;k=w;k=g(2);k=g(5);k=g(1);k=e;k=h;for(;--x>-1;x-1=\
=5?putchar(2<<(--x-1)):x--)printf(k());putchar(sizeof(z)/sizeof(void*));return\
 0;}

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