I am editing some c++ and all of the built in types have been wrapped in a corresponding wrapper class. All of the operators have been overloaded to do bizarre things like operator coded to ignore the argument or to exactly what the underlying type would do. Is this malevolent or is there some possibility this is a good idea in some other universe.
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
IMO, your question is made of 2 questions:
Depends. Having own types around existing types is great when you change the underlying type because the existing logic can be preserved (ideally) with no changes. Is like having a 3 tire architecture and you can change the database without changing the business logic. However, creating all those types takes time and developers also need time to learn them...
No. Is bad because it has side effects. Strange bugs may appear because one wasn't aware of the new behavior. Also makes debugging complicated and increases the time/cost of the development process.
Though I have never seen C++ code used this way. In C, stack implementations typically do not use built in types directly. They usually have some MY_INT_32 (not event int32_t from stdint.h). This is required for very high portability. You will be amazed by the peculiarities of some of the platforms (12 bit integers anyone?).