[MOAB-dev] [Itaps-users] [PATCH 1/2] iMesh_MOAB: do not allocate new memory for count=0 items

Jed Brown jed at 59A2.org
Fri Jun 10 14:02:48 CDT 2011


On Fri, Jun 10, 2011 at 20:59, James Porter <jvporter at wisc.edu> wrote:

> Is your goal merely to make the function fail when the result would be a
> non-empty array?
>

Yes, that is the intended semantic. The zero length is calculated and the
function should fail if we calculated wrong.


> I can't think of any other case where you'd be passing
> in an alloc value of 0 and expect iMesh *not* to allocate for you.
>

See my and Jason's examples.


>
> In any case, a better spec would simply be "if you want iMesh to
> allocate the array for you, pass NULL as the list pointer", (i.e. get
> rid of the case where alloc=0 means "allocate the array for me"). I'm
> not really sure why we need two ways to tell iMesh to allocate the array
> for us.
>

Yes, this is what I am advocating.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/moab-dev/attachments/20110610/97ec6c57/attachment.htm>


More information about the moab-dev mailing list