Monday, May 23, 2011

DON'T hide pointers

I have seen alot of code where typedefs are used to create pointer types like:

typedef unsigned char *Message;
Some people might think that this is a very good thing to do or that it serves some (obscure) purpose but in my opinion such typedefs are plain wrong and evil. They cause alot of errors. Why would a sane person want to hide the fact that a variable of type Message is actually a pointer? It serves no pupose, is usually longer to type and creates disparity between declaration and use of a variable which makes code harder to understand for a new commer and a nightmare to maintain.


Sheikh said...

Good point Adnan! Some food for thought.

meldaresearch said...

Our college paper writing help for students and management research paper services are meant to relieve students off stress they go through as they carry out their academic tasks and also enable them to excel in all their online help essay writing services and research paper services.