Quantcast
Channel: When should I use typedef in C++? - Stack Overflow
Viewing all articles
Browse latest Browse all 14

Answer by Ztyx for When should I use typedef in C++?

$
0
0

typedef allows to not only have an alias for complex types, but gives you a natural place to document a type. I sometimes use it for documentation purposes.

There are also times when I use an array of bytes. Now, an array of bytes could mean a lot of things. typedef makes it handy to define my byte array as "hash32", or "fileContent" to make my code more readable.


Viewing all articles
Browse latest Browse all 14

Trending Articles



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