Quantcast
Channel: Is it a good idea to typedef pointers? - Stack Overflow
Viewing all articles
Browse latest Browse all 16

Answer by Benoît for Is it a good idea to typedef pointers?

$
0
0

Some time ago, i'd have answered "no" to this question. Now, with the rise of smart pointers, pointers are not always defined with a star '*' anymore. So there is nothing obvious about a type being a pointer or not.

So now i'd say : it is fine to typedef pointers, as long as it is made very clear that it is a "pointer type". That means you have to use a prefix/suffix specifically for it. No, "p" is not a sufficient prefix, for instance. I'd probably go with "ptr".


Viewing all articles
Browse latest Browse all 16


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>