Re: [sv-cc] Updated extern/exports proposal - NULL & $root scope


Subject: Re: [sv-cc] Updated extern/exports proposal - NULL & $root scope
From: Andrzej Litwiniuk (Andrzej.Litwiniuk@synopsys.com)
Date: Wed Mar 12 2003 - 11:00:28 PST


> DOUG:
> [...] questions about equating NULL svScope with extern declarations in $root.
>
> I oppose using NULL for this job. There are two reasons:
>
> 1) $root is a valid scope. In the future, a concept of
> "namespace" may be added to the language, in which
> $root would just be the default namespace. We would
> need to distinguish between external functions
> implemented in such namespaces, NULL won't do.
>
> 2) NULL is convenient for users to recognize error scenarios.
> Let's reserve its use for that purpose.

Doug,

I agree with your both points. Joao's proposal didn't explicitly address
the scope of $root, so I simply guessed that perhaps NULL would play that role.
But you are right that it's better to have NULL represent erroneous situations.

Questions (Joao?):
- what would be the effect of calling svPutScope(NULL) ? Error?
- The initial value of context, i.e. prior to any call of context function,
  is NULL, right?

- context will be automatically reset at the return from context function;
  to what value? NULL?
  Or the previous context? (pushed on a stack)

  Consider the scenario: SV --> C --> SV --> C --> ...
  where SV code calls context functions and C code calls exported functions.
  Say: sv_foo1 calls c_foo2,
        c_foo2 calls sv_foo3,
        sv_foo3 calls c_foo4,
        etc,
        then control returns from c_foo4 to sv_foo3 and then to c_foo2.
  What will be the context then? NULL or a context that allows for more
  calls from c_foo2?

Another issue: default/initial value of user data.
svGetUserData() should return NULL if svSetUserData() has not been called
for a specific instance.

Andrzej
 

svGetUserData



This archive was generated by hypermail 2b28 : Wed Mar 12 2003 - 11:01:56 PST