Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2002:
[Freeciv-Dev] Re: newbie C question
Home

[Freeciv-Dev] Re: newbie C question

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: newbie C question
From: "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx>
Date: Tue, 5 Mar 2002 13:14:46 +0100 (MET)

On Tue, 5 Mar 2002, Ben Webb wrote:
>       I think you mean ptr = fc_malloc(11 * sizeof(struct mystruct));

Yes, of course :)

> ptr = fc_calloc(11, sizeof(struct mystruct));
> if (ptr[0].ptr != NULL) free(ptr[0].ptr);
>
>       Assuming struct mystruct has a "ptr" member, that should work,
> since calloc zeroes the memory.

NULL==0 is a valid assumption across all architectures and compilers?

Yours,
Per

"What we anticipate seldom occurs: but what we least expect generally
happens." -- Benjamin Disraeli



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