igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Re: shared library error


From: Gábor Csárdi
Subject: Re: [igraph] Re: shared library error
Date: Thu, 27 Jan 2011 18:35:15 +0100

Dera Sergiu,

On Thu, Jan 27, 2011 at 12:28 PM, sergiu netotea
<address@hidden> wrote:
> Dear Gabor,
>
> I am doing that most of the time. I am also allocating the variable
> properly and all that, but then whenever a simple check is not done
> due to haste a C program will segfault. Since C is not throwing errors
> the way an interpreted language does, it is good to have error checks.

IMHO it is not only "good", it is "necessary".

> Now I am not sure if it would be okay for igraph to test if the file
> pointer is NULL or not when the programmer forgets, but throwing an
> error would sure improve the life of the programmer.

As a general rule, it is not OK to check function arguments. It would
significantly increase the size and running time of the code.
This is not just our rule, in the libc implementations I know, the
fgetc, fscanf, etc. functions do not make such checks, either.

Gabor

> Checking errno
> should have been the first thing to do for me, but I didn't and wasted
> my time debugging. :(

-- 
Gabor Csardi <address@hidden>     UNIL DGM



reply via email to

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