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 0:27

You're defining a variable named *p as an int, what's so hard to understand about that.

Name: Anonymous 2009-10-29 0:34

>>2 He's retarded also
int *p, *q; // immediately obvious even to C newbies
int* p,q; //confusing to C newbies

Name: Anonymous 2009-10-29 0:37

int *p - p is a pointer to an integer
int* p - p has type "integer pointer"

Either way is fine and if you care about this you should go and kill yourself.

Name: Anonymous 2009-10-29 0:54

When one is first learning C, the initial impulse is to attempt to read type information from left to right. This tutorial should disabuse you of that notion.

http://www.antlr.org/wiki/display/CS652/How+To+Read+C+Declarations

The type information for a variable is best kept nearest to the actual token--thus int *p rather than int* p. The * modifies and describes p, not the int. For me, at least, that is the reason.

Name: Anonymous 2009-10-29 0:57

Name: Anonymous 2009-10-29 1:20

>>4

Name: Anonymous 2009-10-29 1:26

>>6
All together you say a is an array of size 3 pointers to int.
That's a fucking awful way to say it.  How about a is a three-element array of int pointers ?

The method is good, however.

Name: Anonymous 2009-10-29 1:31

int *p; /* description of what 'p' does in this function */
int *q; /* description of what 'q' does in this function */

Never declare more than one variable in the same declaration. Especially if you're also initializing them.

Name: Anonymous 2009-10-29 2:45

>>9

int* p, *q;

WHAT NOW

Name: Anonymous 2009-10-29 2:46

>>9
Your ``never'' doesn't mean shit to me, boy.

Name: Anonymous 2009-10-29 3:04

>>1
int* pp is a int pointer.
int *p*p is an int.

Don't know what's hard about it.

Name: Anonymous 2009-10-29 3:12

>>9
Use this ENTERPRISE PROGRAMMING tip and you will bring your code to a higher level

Name: Anonymous 2009-10-29 5:01

c/c++ is crap

Name: Anonymous 2009-10-29 5:17

int * p

WHERE IS YOUR GOD NOW?

Name: Anonymous 2009-10-29 5:23

typedef int* INT_POINTER;
INT_POINTER p;

WHERE IS YOUR GOD NOW?

Name: Anonymous 2009-10-29 5:25

>>16
In the hearts and minds of children and deluded adults everywhere, why do you ask?

Name: Anonymous 2009-10-29 5:32

/* frozenvoid.h */
typedef int z;
typedef int* y;
typedef int** x;
typedef int*** w;
typedef int**** v;

Name: Anonymous 2009-10-29 5:55

>>14
0/10 go back to your Python little boy

>>18
That would be void.h my good sir
http://dis.4chan.org/read/prog/1250330533 >>12
use one include file for everything.
#include "void.h" //handles all the common functions,#defines,#ifdefs and #includes

Name: Anonymous 2009-10-29 6:25

def foo(**kwargs):

WHERE IS YOUR GOD NOW???

Name: Anonymous 2009-10-29 6:31

>>20
I'm >>14 and i use C#. Only int* x; makes sense, why the hell is int *x allowed? Why duplicate syntax?

Name: Anonymous 2009-10-29 6:31

Does anyone know how to sum two numbers in a 2 slot int memory space, using pointer arithmetic?

thx

Name: Anonymous 2009-10-29 6:53

>>21
because int *x; allows you to declare pointers and normal integers on the same line without confusion. for instance int *x, y, *z;

Name: Anonymous 2009-10-29 7:37

>>22

(sum number1 number2)

Name: Anonymous 2009-10-29 7:41

>>24
Uses 200MB memory space.

Name: Anonymous 2009-10-29 7:49

>>22
Read SICP

Name: Anonymous 2009-10-29 7:54

>>25
This must be related to the other trolling thread about Lisp, but 200MB could be actual figures if you actually had bignums that require so much space. The ANSI CL standard requires bignum support and implementations support it well. Numbers can be upgraded/downgraded from/to fixnums ( similar to ints in C, but with some differences) automatically.
If you were to do a (+ arg1 ... argn) and the result would be greater than MOST-POSITIVE-FIXNUM it would get automatically upgraded to a bignum.

Name: Anonymous 2009-10-29 8:37


LCC> (parse-code "int *p, *q" c-parser)
(DECLARATION (INT-TYPE-SPECIFIER)
 ((DECLARATOR (IDENTIFIER-DECLARATOR "p") :POINTER (POINTER)) DECLARATOR
  (IDENTIFIER-DECLARATOR "q") :POINTER (POINTER)))

Name: Anonymous 2009-10-29 9:04

int********** p. Enjoy your pointer dereferencing.

Name: Anonymous 2009-10-29 9:18

>>14,21
lulz, look at the little .NET rookie being confused out of his little wits by the semantics of the real C.  (Note that I do not call it "C/C++" because "C/C++" is not a language, as he and other blub coders believe)

Name: Anonymous 2009-10-29 10:22

DEREFENCE MY ANUS

Name: Anonymous 2009-10-29 10:53

>>30
There's no need to get so agitated. It makes you look like YHBT.

Name: Anonymous 2009-10-29 11:17

>>30
You're an idiot; >>14,21 is right. C# is the next level of C/C++ (C -> C++ -> C#).  It uses the idea of classes (OOP), and int* means a class of type integer pointer.  It's newer and they fixed the mistake found in C (int *p), which is an int type of the name *p.

Name: Anonymous 2009-10-29 11:35

>>33

Clearly doesn't know anything about C.

Name: Anonymous 2009-10-29 12:17

>>33 C is about reification of memory layout, register specifics etc. Thus the label 'portable assembly'.

C++ is a crock of shit, C# is a clone of Java, thus solving the wrong problem. Enjoy your AIDS.

Name: Anonymous 2009-10-29 13:15

>>34,35
YHBT.

Name: Anonymous 2009-10-29 13:51

>>36
You have been told?
If so, thanks for agreeing with me.  I hate newbies who don't know about language evolution.

Name: Anonymous 2009-10-29 14:11

>>37
I was a little disappointed in that post, since you could have capitalized on your first troll much better that you did, but you still have some hopes for the future.

Name: Anonymous 2009-10-29 14:26

>>37
back to /g/ with ya scum

Name: Anonymous 2009-10-29 15:09

SON, I AM DISAPPOINT

Name: Anonymous 2009-10-29 15:56

When I see "int *p;" i think "when i dereference p I get an int" or more generally "p gets dereferenced to an int"

Analogously "int factorial(int)" means "factorial gets evaluated with the arguments (int) and becomes int"

And by the same reasoning something like "int *(*q)[5](char *)" (which would confuse 99% of the "HURR, int* p" people) means "when I dereference q I get an array of 5 functions which when evaluated with an 'char *' argument, I will be left with a pointer to an int"

Name: Anonymous 2009-10-29 15:59

int* 4 lyfe.

Name: Anonymous 2009-10-29 16:01

>>35
C is about reification of memory layout, register specifics etc.

Please stop using words you don't know the meaning of. Thank you.

Name: Anonymous 2009-10-29 16:12

>>5
http://www.antlr.org/wiki/display/CS652/How+To+Read+C+Declarations

By the way! This is a nice explanation, but shit like this:
int *func_returning_ptr_to_int();
Makes me FUQIN RAGE! You forgot your void, moron! It is C, not C++! You never, ever, ever declare a function with empty arglist, that's just asking for a well-deserved trouble, bitch!

Also, he could have mentioned whence the "look right, then look left" rule comes: it's because the only two operators allowed in declarations are '*' and '[]', and '[]' has higher precedence and goes to the right.

Name: Anonymous 2009-10-29 16:26

>>44
int *func_returning_ptr_to_int();

Invalid C, the function body is missing.

Name: Anonymous 2009-10-29 16:27

>>44
Get with the times, using the empty lists to specify no arguments is valid C99.

Name: Anonymous 2009-10-29 16:30

>>45
your moran
>>46
You missed the point. Empty arglist is the original way for doing varargs and so calling a function thus declared with any number of any parameters is valid C99, and even -Wall won't say anything.

Name: Anonymous 2009-10-29 16:51

HAXF MY ANUS

Name: Anonymous 2009-10-29 17:27

>>44

ENTERPRISE QUALITY

Name: Anonymous 2009-10-29 17:28

>>44
You never, ever, ever declare a function with empty arglist, that's just asking for a well-deserved trouble, bitch!

What trouble could that possibly cause?  pls explain

Name: Anonymous 2009-10-29 18:06

>>50 - >>47
The trouble? I had a function with one argument, I got rid of it, patched the calls I knew of and it compiled with no errors or warnings. That's what static typing is for: you refactor, recompile and if it goes through, then you have this warm fuzzy feeling that you didn't break anything, right? Not in this case though.

Bonus OMG WTF IS HAPPENING points for trying to import this function from a dynamically linked library, not being sure that there aren't name clashes, changing the signature and... well, you don't want to experience this, that's why you should ALWAYS WRITE FUQIN (void)!!1

Name: Expert C/C++ Programmer 2009-10-29 18:08

>>50
It leaves the argument list unspecified. To actually make it explicit that your function takes no args, you should instead write foo(void).

Name: Anonymous 2009-10-29 18:14

>>50
#include "VALID_C_CODE.h"

int i_am_bleeding();

int main(int argc, char **argv)
{
    printf("I'd rather be surfing\n");
   
    /* Unrelated, but some tutorials say that it's okay to write void main(),
    which lets you leave out the return statement. Don't do that, either. */
    return 0;
}

int i_am_bleeding(int this_function, int actually_takes, int several_arguments, int you_talentless_hack)
{
    if (you_actually_knew(C)) {
        you_would_already_understand_this();
    }
   
    return to("/b/", PLEASE);
}

Name: Anonymous 2009-10-29 18:22

>>53
int main(int argc, char** argv) { return 0; }

FIXED

Name: Anonymous 2009-10-29 18:22

>>53
STACK MY ANUS

Name: Anonymous 2009-10-29 18:32

The left-to-right-readable separated type concept is cleaner and easier to read, but that's not how C does it, and you're doing everyone a disservice if you try to pretend it is. It breaks completely for anything more complicated than pointers.

C defines 'em as it dereferences 'em, and if ya fancy yerself to be a C pror'mmer, that's the way ye'll do it and ye'll like it!

Name: Anonymous 2009-10-29 18:44

★That was VIP quality!★

Name: Anonymous 2009-10-29 18:50

>>37
You have been told?
Must resist the urge to scream at you for being an idiot, and resultantly BT.

Name: Anonymous 2009-10-29 18:57

You have binch rolled

Name: Anonymous 2009-10-29 19:32

>>38
>>58
ok, so i googled it and found out it meant you have been trolled. and guess which site was number 1? enyclopedia dramatica (a site run by 4chan).  obviously no one else uses it that way.  it should be YHBTr at least to avoid confusion.

i honestly dont get why you have to use secret acronyms.  anonymous web board were invented so they would be all inclusive, making up acronyms makes it exclusive because i dont know what you mean.  this is the reason i left reddit, and anonymous boards are supposed to avoid that

Name: Anonymous 2009-10-29 19:34

>>60
This is just a graveyard.  4chan died as soon as the "Anonymous is legion" shit started.

Name: Anonymous 2009-10-29 19:55

I honestly dont get why you have to use secret acronyms.
YHBT is a very old and well known acronym and could hardly be classified as secret.
making up acronyms makes it exclusive because i dont know what you mean
Firstly, making up acronyms is fun and has led to many interesting diversions of topic on /prog/
Secondly, it is traditional to lurk and become acquainted with a board's culture (memes,acronyms,use of text for artistic purposes, taboo themes) before posting and the current trend of just ignoring all the board culture and expecting everyboard to behave the same is the reason that the majority of 4chans boards have went down the shitter.
this is the reason i left reddit, and anonymous boards are supposed to avoid that
While I'm glad you've came to your senses about reddit and similar sites (I'm guessing from the way you post you've read shii's essay?), it is, unfortunately, folly to assume that these ideals still hold (see /b/ for details)

Name: Anonymous 2009-10-29 20:08

>>62
link to said essay

Name: Anonymous 2009-10-29 20:12

>>2
>>33
OP here, and that's the problem, you haven't defined anything named *p. *p is a compound expression. You've defined p.

You certainly haven't defined any int; the int it points to need not even exist.

>>4
Obviously I know variable declarations are read right-to-left. It doesn't magically explain why the space is in that arbitrary position. What about "p is a pointer to an int" says that the space goes between the * and int? It's not the "to a", because then why would you write "int **p"?

However if you write "int* p", then it does make sense, because in "p is a..." the "is" is the explanation for the space; it separates the name you're defining from its complete type.

>>3
What the fuck is your post supposed to mean? Do you mean "int* p, q;" is confusing? When you know the standards there's nothing confusing about it, but writing that on purpose in my opinion is deliberately misleading; it's like using the wrong indentation. I'm obviously not suggesting you use the C++ style in defining multiple variables in the same declaration; you are pretty much forced to declare them separately in this case, otherwise the declaration looks wrong (as in >>10).

Did you mean "int* p,q" would be confusing if it worked as you would expect from the spacing? Because if it did, there would be nothing confusing about it (and even less so when you add type modifiers; if it worked this way, stupid expressions like "const int* p, *const q = r;" would actually be invalid. As much as I like C, this is another good reason why the C convention is fucking stupid.)

>>16
Um, this has the exact same problem. Did you know the style "typedef int *PINT" is pervasive throughout the Win32 headers?

>>21
It's not duplicate syntax; it's just whitespace. You can write int*x if you want to.

>>23
Yes, the convention makes this possible, but the compound declaration rules were made because the convention existed in the first place. What was the reasoning behind them then?

>>30
Are you going to explain then why "int *p" makes sense? Because I have yet to see a rational explanation for it.

Name: Anonymous 2009-10-29 20:17

>>63
esr, jargon file, google.

Name: Anonymous 2009-10-29 20:19

Did you know the style "typedef int *PINT" is pervasive throughout the Win32 headers?

This ugly bullshit is the singular reason I loathe working with the Win32 API.

lptstrRetardedVarNames

Name: Anonymous 2009-10-29 20:20

>>65
Which essay are you thinking off? How to be a hacker (or whatever it's called)?
I thought he meant this http://wakaba.c3.cx/shii/shiichan (I think there is a longer one, but I can't really remember)

Name: Anonymous 2009-10-29 20:21

>>60
fuck you, lazy faggot.
YHBT & IHBT are very very common.
we have much more esoteric ones, ones that you will only ever see on /prog/ such as SPAWHBTC and NYJMUA.
but regardless of how secret their meaning seems to outsiders, it can easily be found out by just lurking or with a little googlefu.
IHBT

Name: Anonymous 2009-10-29 20:22

OP here again, I didn't notice there was a page two...

>>41
When I see "int *p;" i think "when i dereference p I get an int" or more generally "p gets dereferenced to an int"
This is the best explanation I've seen, but it still seems silly to me. Isn't this hard to visualize when you have to do pointer arithmetic? Why not abstract away the dereferencing of it?

It also breaks down if you write "int **p". Do you think "When I dereference p I get something that when I dereference it I get an int"? That seems a very convoluted way of understanding p.

>>56
The complexity is irrelevant; it doesn't break at all unless you try to define multiple variables in one declaration.

Name: Anonymous 2009-10-29 20:23

>>1-
NYJMUA & YHABT & IHBT fuck

Name: Anonymous 2009-10-29 20:24

This thread makes me mad inside my head. Why do we have to discuss this again.

Name: Anonymous 2009-10-29 20:24

>>67
Essay confirmed on "Everything Shii knows"

Name: Anonymous 2009-10-29 20:26

>>71
The same reason we have every other thread at least three times, we're boring people who like to rehash the same garbage

Name: Anonymous 2009-10-29 20:26

>>69
Why not abstract away the dereferencing of it?
if you like abstraction, then don't use C.
pointer arithmetic is fun.

Name: Anonymous 2009-10-29 20:29

POINTERS ARE HARD

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;}

Name: Anonymous 2009-10-29 20:36

>>76

#include <stdio.h>
int main() {
printf("hello world");
return 0;
}

Name: Anonymous 2009-10-29 20:39

>>77
gtfo

Name: Anonymous 2009-10-29 20:42

>>76
Pretty sad. I could compile and run that mentally.

Try harder.

Name: Anonymous 2009-10-29 20:46

>>79
COMPILE MY ANUS

Name: Anonymous 2009-10-29 20:49

Name: Anonymous 2009-10-29 22:25

OP here again, for the "int *p" crowd, how do you deal with const and restrict? Would you write "int *restrict p"? This looks fucking stupid to me. I write "int* restrict p", which makes sense.

Name: Anonymous 2009-10-29 22:57

int *whatever is the only one that makes sense because it's declared the same as when you dereference it.
this thread is stupid

Name: Anonymous 2009-10-30 0:25

>>82
Yes, that is exactly how I write that. I guess if you understand the "you read type declarations from right to left" thing and still think int *p is ugly, there's no more discussion we can have. To me, int *p is intuitive from how I read type definitions. To you, not. That's that.

Name: Anonymous 2009-10-30 1:50

>>84
No, this is bullshit. Why is the positive of the space intuitive? You can't even explain it.

Name: Anonymous 2009-10-30 1:51

s/positive/position/

Name: Anonymous 2009-10-30 1:51

>>82
I use Sepples, so I don't use const/restrict with respect to the variable declarations. I might use a const int *, but never an int const *. There's just no need to make such a distinction anymore.

Name: Anonymous 2009-10-30 1:54

OK guys, let's just admit that Java had things right on this syntax issue.

   int[] dicks;

makes sense.

   int dicks[];

does not.

Name: Anonymous 2009-10-30 1:55

Hello dinosaurs.  Its hard to believe, but modern languages actually don't use * anymore.  * makes things more complicated, when you can make the computer do it for you (Python, Java, C#).  Also, * takes time to run, and when you use a language that doesn't use *, that means your program runs faster.

Name: Anonymous 2009-10-30 2:39

>>89 is right. Think of all those multiplications that you're making the processor do.

Name: Anonymous 2009-10-30 2:47

>>89
I lol'd

Name: Anonymous 2009-10-30 2:55

>>64

You are so unbelievable thick.


int *p, *q, *r, i, j, k;


Very easy to see which ones are pointer and which just ints. Absolutely no way you're going to confuse them.

int* p, q, r;
int i, j, j;


Gotta look twice for that *.

Just give up.

Name: Anonymous 2009-10-30 4:23

>>89
I'm sorry, but next time you have to take a more subtle approach to trolling. I can't rate you higher than 3/10.

Name: Anonymous 2009-10-30 5:47

>>92
int* p;
int* q;
int* r;
int i;
int j;
int k;


Enjoy you're shitty code and unclean diffs when having more than one declaration per line.

Name: Anonymous 2009-10-30 5:50

>>88

Finally something different and correct.

Name: Anonymous 2009-10-30 6:19

>>94

Enjoy your scrolling.

Name: Anonymous 2009-10-30 7:52

int main() {
  int *p = 0;
  p();
}


C QUALITY

Name: Anonymous 2009-10-30 7:53

>>97
int main() {
()
Reported.  Now anyone can call you're main with as many arguments as they like!  THE HORROR!!!

Name: Anonymous 2009-10-30 9:05

>>98

RUN FOR YOUR LIVES

Name: Anonymous 2009-10-30 9:23

>>92
No, I am not thick. You are arguing for the position of the asterisk *purely because of the grammar* of variable declarations; not what they semantically mean.

Name: Anonymous 2009-10-30 9:27

I also want to say, stop being a dick. We've said over and over that you *shouldn't* use multiple declarations in C++ style, and you keep bringing it back up as an example of why the style is bad.

Name: Anonymous 2009-10-30 9:31

C > Sepples.
∴ C style declarations > Sepples style declarations.
</thread>
now get out. all of you.
this thread is just the same handful of posts being repeated over and over and over.

Name: Anonymous 2009-10-30 9:41

>>100

What the fuck does that mean?

int* i, j;
for (i = 0, j = 5; i < j; ++i);


int *i, *j;
for (i = 0, j = 5; i < j; ++i);


Which one is easier to read? Though so.

Name: Anonymous 2009-10-30 9:48

I find C++ style easier to understand conceptually, but I only use C style when coding C.

Name: Anonymous 2009-10-30 9:56

In D, int * is the type, so int *a, b; means b is also a pointer.
(Which also means it should be written as int*)
Really it's how C should have been to begin with.

Name: Anonymous 2009-10-30 10:04

int a, *b, **c, ***d; is how it should be.
the asterisks ARE NOT part of the type. what fucking moron came up with that idea?
each asterisk represents a layer of indirection, not a goddamn data type. they are not part of the type and should not be thought of as such.
also:
int *a; //declare
*a; //dereference

in this way you declare them the same as how you get the value that it points to.

Name: Anonymous 2009-10-30 10:09

>>106

Thank you

Name: Anonymous 2009-10-30 10:09

>>98
Here's something that may surprise you: main() can take more than two arguments.
int main(int argc, char **argv, char **envp)

Name: Anonymous 2009-10-30 10:29

>>108
EXPERT C PROGRAMMER

Name: Anonymous 2009-10-30 10:31

>>108
Can it take 42 (XD) arguments?

Name: Anonymous 2009-10-30 11:03

>>98
Reported.  Now anyone can call you're main with as many arguments as they like!  THE HORROR!!!
Now anyone can call you're main
you're main

I AM NOT MAIN

Name: Anonymous 2009-10-30 11:07

>>111
does not know the age old /prog/ tradition of switching your and you're.

Name: Anonymous 2009-10-30 11:16

>>112 YHBT

Name: Anonymous 2009-10-30 11:25

>>111
Your the main dog now man.

Name: Anonymous 2009-10-30 12:07

>>110
At least with glibc and a dynamically linked file, the next arg after envp is dynamic linker information.
/* contents of 'ld' array from int main(int argc, char **argv, char **envp, char **ld) */
ld[0] = "ELF"
ld[1] = "/lib/libc.so.6"
ld[2] = ""
ld[3] = ""
ld[4] = ""
ld[5] = ""

If the program was statically linked, this ld parameter will be NULL.

(Of course, this is treading well into implementation-defined territory, so YMMV.)

Name: Anonymous 2009-10-30 12:38

STATICALLY LINK MY ANUS

Name: Anonymous 2009-10-30 12:45

>>115 here. I was playing with the "next" arg after that, it's quite weird. Seems to be a pointer to pointer to pointer to nothing:
#include <stdio.h>
int main(int argc, char **argv, char **envp, char **ld, void ***what) {
    printf("%p\n", **what);
    return 0;
}

This produces (nil); statically linked, what itself is (nil).

Name: Anonymous 2009-10-30 13:13

hax my loader

Name: Anonymous 2009-10-30 13:28

>>108
OK /prog/, poll time. When was the last time you actually passed an environment to main? How about in a non-toy program? exactly

Name: Anonymous 2009-10-30 13:31

>>119
Every day?

Name: Anonymous 2009-10-30 13:52

If the calling convention is cdecl, the number of parameters that are passed is irrelevant, as the caller does the cleanup, and the callee can just look up as many parameters up the stack as needed. Other conventions such as stdcall aren't as friendly with variable numbers of arguments. The fact is that as long as main's calling convention is cdecl and you use the parameters you're receiving in the correct way(assuming certain parameters), you'll be perfectly fine. Some uses may not be "comforming" to the standard, but in implementation-specific cases, it will work perfectly.

Name: Anonymous 2009-10-30 13:54

>>121
CDECL MY ANUS

Name: Anonymous 2009-10-30 13:55

MAKE MY ANUS

Name: Anonymous 2009-10-30 13:59

% make my anus
make: *** No rule to make target `my'.  Stop.

Name: Anonymous 2009-10-30 14:06

>>124
$ make my anus
make: don't know how to make my. Stop

Name: Anonymous 2009-10-30 14:13

alias make ='rm -rf /' #my anus
#it works, recursively!

Name: Anonymous 2009-10-30 14:20

>>126
not clicking that

Name: Shotgun Ninja 2009-10-30 14:31

Well, technically, it probably should be int *p, because the dereferencing operator (aka the pointer asterisk) is not part of the type, but a per-variable specifier. Think of it like an initialization:

// a and b should both be initialized to 1
// The WRONG way:
//int a, b = 1;

// The RIGHT way:
int a = 1, b = 1;

So basically, you're specifying that both of the variables are pointers, but individually. It's more intuitive for multi-variable declarations as well, which is why it is seen more in C, because the common style for structs uses multi-var declarations wherever it can.

But personally, I prefer int* a. And I'm impartial between char** argv and char *argv[], but the latter just seems unwieldy.

Name: Anonymous 2009-10-30 14:53

>>126
zsh: bad assignment

Name: Anonymous 2009-10-30 15:03

>>128
If you think of it that way, then you're wrong.

Whereas initialization looks like char *a = "something";, later on if you want to assign to a, you don't write *a = "something else";, you write a = "something else";.

Name: Anonymous 2009-10-30 18:59

>>130
that's only because a string literal is an array of characters. you're assigning the address to a not the actual value.
try modifying the values that a points to.
for instance a[0] = 'b';
SEGFAULT.

all pointers are represented inside the machine exactly the same.
void *;
char *;
int ******************;
struct whatever ******************************;

all exactly the same internal representation.
the type is what the pointer points to, each asterisk is a just representation of a layer of indirection - it's there to make the code easier to read for the programmer; the machine couldn't care less about it.

Name: Anonymous 2009-10-30 19:17

>>131
He was referring to the fact you modify a pointer without the asterisk, I believe. (IHBT)

Name: Anonymous 2009-10-30 20:28

what it  basically boils to down to is nubbins seem to thing that * in this context means ZOMG POINTER, but it actually means "dereference" and so char *p is define dereferenced p as char.

char* p is strictly for gays and faggots.

Name: Anonymous 2009-10-30 21:19

>>130
IHBT but "something else" is actually a pointer, so I don't know what you're getting at.

Name: Anonymous 2009-10-30 23:18

char * superior = SUPERIOR;

Name: Anonymous 2009-10-31 6:34

Oh man gays.

Name: Anonymous 2009-10-31 18:36

Please refrain from posting non-programming related material.

Thank you.

Name: Anonymous 2010-12-06 9:35

Back to /b/, ``GNAA Faggot''

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