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:
Anonymous2009-10-29 0:27
You're defining a variable named *p as an int, what's so hard to understand about that.
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:
Anonymous2009-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.
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.
>>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:
Anonymous2009-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.
>>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:
Anonymous2009-10-29 6:25
def foo(**kwargs):
WHERE IS YOUR GOD NOW???
Name:
Anonymous2009-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:
Anonymous2009-10-29 6:31
Does anyone know how to sum two numbers in a 2 slot int memory space, using pointer arithmetic?
>>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.
int********** p. Enjoy your pointer dereferencing.
Name:
Anonymous2009-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)
>>30
There's no need to get so agitated. It makes you look like YHBT.
Name:
Anonymous2009-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.
>>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.