igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Destroying uninitialized graphs


From: Matthew Walker
Subject: Re: [igraph] Destroying uninitialized graphs
Date: Mon, 7 Mar 2011 18:30:48 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7

Hi Gabor, Tamas,

Thanks again for your suggestions.

I cannot help but ask, why isn't this approach available inside igraph?

There could be an igraph_zero() function, that just zero'd the memory used in igraph_t. Such a function would mean that igraph_destroy() could then be made safe to call on zero'd graphs.

Thanks again,

Matthew

On 11-03-07 10:34 AM, Gábor Csárdi wrote:
Matthew,

there is no such function. You need to keep track of that. It is
actually not possible to write such a function, IMHO, because some
architectures do not zero out newly allocated memory. Although,
probably most of the do, nowadays.

What you can do, is filling the igraph_t by zeros after you allocate
it, and then check whether the 'from' field is zero or not. It should
not be zero for a valid graph.

Best,
Gabor

On Mon, Mar 7, 2011 at 10:28 AM, Matthew Walker
<address@hidden>  wrote:
Hi,

I currently have a problem in that my program seg faults because I am
calling igraph_destroy() on an uninitialized graph.

Is there a function to tell whether the graph is initialized?

Thanks,

Matthew

_______________________________________________
igraph-help mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/igraph-help






reply via email to

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