« first day (321 days earlier)      last day (3535 days later) » 

 
5 hours later…
16:13
nice discussion on Reddit
> I'm not saying I shouldn't have to explicitly handle the file missing case. I'm saying I want to use Maybe and IO and get better at haskell! But now a lot of my code has to take this into account. In C I do this (example found on interwebz):
get_file_size (const char * file_name)
{
    struct stat sb;
    if (stat (file_name, & sb) != 0) {
        fprintf (stderr, "'stat' failed for '%s': %s.\n",
                 file_name, strerror (errno));
        exit (EXIT_FAILURE);
    }
    return sb.st_size;
}
> Something like this?
get_file_size :: FilePath -> IO Int
get_file_size path = do
    msize <- fsize path
    case msize of
        Nothing -> do
            hPutStrLn stderr "fsize failed"
            exitFailure
        Just size -> return size
@BartekBanachewicz usually common problem with this kind of code, what if... the file path exists BUT it's a dir?
 
3 hours later…
18:54
helloc all;
hmmm C14 surely looks a lot like haskell
 
4 hours later…
23:09
I want to allocate memory for array of pointers. my question is - if I use malloc of the pointers will be NULL at the beginning? or I need to use calloc for this?
Thanks!
helloc all;

I want to allocate memory for array of pointers. my question is - if I use malloc of the pointers will be NULL at the beginning? or I need to use calloc for this?
Thanks!
helloc all;
23:24
helloc @Alon;
yes, you have to use calloc for that..
23:53
@PeterVaro thanks!

« first day (321 days earlier)      last day (3535 days later) »