|
Good programming practice is to initialize the pointer to NULL, check whether the allocation is successful after allocating space, and return NULL immediately after the space is successfully released. If it is a pointer shared by multiple threads, plus mutual exclusion protection during operation;
In this way, when you use a pointer, you only need to check whether the pointer points to NULL, and you can know whether the pointer is valid.
If you ignore the above premise, what you can do at most is to redefine your structure so that this structure has a specific value at some specific position. Based on this, I think it will not Does anyone really do this. |
|