mercredi 6 mai 2015

Which dummy pointer values are okay

This is something that's been on my mind for a long time. Every once so often i see people use 1, or -1 as a dummy value for a pointer. To safe the need of a different variable.

Is it okay to use pointers like this? I suppose -1 is okay. But is it also okay to use other negative numbers? And can i be sure 1 isn't a used memory location? And if so, up to which value can i use memory pointers.

P.s. I'm aware storing other data especially positive values in pointers, is bad practice. But I'm just wondering excatly how bad it is.

Aucun commentaire:

Enregistrer un commentaire