I can't imagine any situation where you would need 3 or more levels of indirection for a pointer.
int i = 0; int *ip01 = &i; int **ip02 = &ip01; int ***ip03 = &ip02; int ****ip04 = &ip03; int *****ip05 = &ip04; int ******ip06 = &ip05; int *******ip07 = &ip06; int ********ip08 = &ip07; int *********ip09 = &ip08; int **********ip10 = &ip09; int ***********ip11 = &ip10; int ************ip12 = &ip11; ************ip12 = 1; /* i = 1 */
Name:
Anonymous2014-05-19 9:48
I can't imagine any situation where you would need 3 or more levels of indirection for a pointer.
Two levels of indirection should be enough for anyone
Name:
Anonymous2014-05-19 11:01
>>4 Why? Because your tiny brain cannot understand anything more complex? That's hardly enough reason to limit the usage of the tools for the rest of us.
>>1 2 ought to be enough for anybody not living in a basement
Name:
Anonymous2014-05-19 12:10
I can imagine a situation for 3 levels of indirection, if you pass in the address of a 2-star pointer so that the function can change the value of the pointer itself, but that's already some pretty bad design - anything beyond that is retarded.
If you remove data structures from C/C++, then something like ptr->field_a->field_b->field_c would translate into *(*(*(ptr+a)+b)+c), and when a=b=c=0, we have ***ptr - i.e. 3 stars
So tree star programmer is a bad programmer, because such person doesn't know how to refactor his code or use data structures.
Name:
Anonymous2014-05-19 14:24
I spread my ass and poo on the /prog/ It will never be the same again.
this thread was posted on /g/. And all posts consisted of >>1,4,6,7,8,10. Please go back there. A programming language is a paintbrush and pallet. You can't just say turquoise is stupid. Use it if it fits your purpose. Don't use it if it doesn't.
A programming language is a paintbrush and pallet.
Wow, I didn't realise I was in the presence of such a skilled artisan...GET OFF MY LAWN.
Name:
Anonymous2014-05-20 9:08
>>17 Programming and software design is an art. The paintbrush and pallet is a metaphor that alludes to the nature of applying tools with different strokes to result in something good.
Name:
Anonymous2014-05-20 9:27
>>13 Just look at yourself, You fucking armchair snotty stackexchange shitbags who, between reading Coding Horror!, flick over to /prog/ and try to make themselves feel superior by defending triple dereferencing.. Listen up you little fucking babies, I've been hacking down to the guts of these metal machines before you were born. I've written self modifying machine code so optimized it invented algorithms by itself that havent even been discover yet. I can CDR-code a lisp interpreter to the point that garbage collection is O(1). I designed an entire FORTH based operating system and implemented it in 1kb. I CHEW CPUS UP WITH MY TEETH. AND NEVER ONCE HAVE I DEREFERENCED MORE THAN THREE TIMES.
Name:
Anonymous2014-05-20 11:16
Is there something pointers are particularly good for? They don't really seem essential.. =D