|
|
|
|
|
by kazinator
2760 days ago
|
|
By definition, if avoiding something isn't possible, then there cannot be a "how to avoid". Why even mention a non-starter choice, like using type punning through a void pointer, as an alternative to a forward declaration. If a construct is "not possible to avoid" that generally means "not possible to avoid without changing the structure of code and run-time data (let alone changing them to something unsafe)". Gratuitous forward declarations of C++ classes are "bad" for various reasons. Such as: people sometimes write them just to shut up the compiler, instead of including the right header to provide that declaration. "I'm just using a pointer to this; what's the harm." It makes perfect sense for a coding standard to advise against this. |
|