C++ Pointers: Number of levels of Indirection
Posted
by
A B
on Programmers
See other posts from Programmers
or by A B
Published on 2012-12-17T23:36:18Z
Indexed on
2012/12/18
5:13 UTC
Read the original article
Hit count: 497
In a C++ program that doesn't contain legacy C code, is there a guideline regarding the maximum number of levels of indirection that should be used in the source code? I know that in C (as opposed to C++), some programmers have used pointers to pointers for a multiple dimension array, but for the case of arrays, there are data structures in C++ that can be used to avoid the pointers to pointers.
Are users who still create pointers to pointers (or more than this) trying to use pointers to pointers only for performance ETC. reasons?
I have tried NOT to use any more than a pointer to a pointer, only in the case that a pointer needed modification; does anyone have any other official or unofficial guidelines or rules regarding the number of levels of indirection?
© Programmers or respective owner