Re: [sv-cc] Final proposal for user data management


Subject: Re: [sv-cc] Final proposal for user data management
From: Andrzej Litwiniuk (Andrzej.Litwiniuk@synopsys.com)
Date: Thu Mar 27 2003 - 11:20:39 PST


> > void svPutUserData(svScope scope, void* userKey, void* userData);
>
> MICHAEL:
> I would suggest to have a return value of type 'int' that reflects possible
> error conditions like
> - O.K.
> - invalid scope
> - invalid user key (do we permit NULL as userKey ?)
> - collision in scope
>
> I really don't like functions that forget to tell me that something went wrong ...

Run-time error?
Sure, a status explicitly returned gives more flexibility, but in the case of
non-void function it would take an additional output arg (&status).

> > void* svGetUserData(svScope scope, void* userKey);
>
> MICHAEL:
> define the return value NULL for an invalid scope or key

No!!!! NULL may be a valid user's value. ("Have I already allocated my C data
associated with that scope? NULL if not allocated yet.")

This reminds me that the description of svGetUserData(), and of all "get"
functions coupled with "put" function, should define what will be the initial
value, i.e. what "get" returns if called prior to "put".
NULL/zero seems a natural candidate.

Andrzej



This archive was generated by hypermail 2b28 : Thu Mar 27 2003 - 11:21:58 PST