> How can I test whether an igraph_t variable has been initialised already?

This is a bit of a hack, but in the worst case you can try the following. 
Whenever you create an igraph_t on the stack or allocate an igraph_t on the 
heap, set all of its bytes to zero using memset(). When you initialize a graph 
using igraph_init, it is pretty sure that at least one of the bytes will be 
changed in the igraph_t structure, so in the worst case you can create a 
utility function that evaluates every single byte of an igraph_t and returns 
true if and only if all the bytes are zeros. (However, you should also make 
sure to call memset() again after an igraph_destroy() operation).

Now that I read it again, it seems even more horrible than before. Gabor’s 
solution is definitely much better, but if you don’t feel like introducing a 
myigraph_t for this purpose, this could be an alternative.

T.




_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to