[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] How to test for initialisation?

From: Timothy Rice
Subject: [igraph] How to test for initialisation?
Date: Tue, 21 Jan 2014 20:24:53 +1100
User-agent: Mutt/1.5.21 (2010-09-15)


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

I'm getting a segfault when I call igraph_destroy on an uninitialised
graph. I would have expected that igraph_destroy would simply not do
anything in this case, but given that igraph_destroy seems to assume a
pre-initialised graph, how can I avoid the segfault?

It's not possible for me to know at compile-time whether the graph in
question has been initialised. It depends on user input, which selects
between various graph operations using function pointers. Most of these
function pointers result in an initialised graph, but sometimes not.
Regardless of user input, I'd like to ensure I destroy all graphs whenever
they exist before the program exits.

If my meaning isn't clear and you need some example minimal code, let me
know and I'll see what I can cook up :-)


Tim Rice
PhD Candidate
A: Room 210, Richard Berry (Maths & Stats), Melbourne University
E: address@hidden
W: http://www.ms.unimelb.edu.au/~trice

Attachment: pgpgYGkTsQg6K.pgp
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]