slang-users mailing list

[2007 Date Index] [2007 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [slang-users] C Structure help ...


And another question .....

What are the advantages/disadvantages of using passed values
versus POP'd values ?

i.e.:

static int
apgn_replace(char *value, int *attribute)
{
   APGN_Type *p;

   SLang_MMT_Type *mmt;

   ..........

   if (NULL == (mmt = SLang_pop_mmt (APGN_Type_Id)))
     {
        SLang_free_mmt (mmt);
        return -2;
     }
   p = SLang_object_from_mmt (mmt);
   replace(p->apgn_db, value, *atribute, 0)
   ............

Where INSTRINSICS are defined as:
...

MAKE_INTRINSIC_SI("apgn_store", apgn_store),
....

********   versus  *********

static int
apgn_replace( VOID )
{
    char *value ;
    int  attribute ;
    SLang_MMT_Type *mmt;

    if ( SLang_pop_integer ( &attribute ) != 0 )
    {
     SLang_verror (SL_INVALID_PARM, "\n Incorrect parameters!\n ");
     return -1 ;
    }

    if ( SLpop_string ( &value ) != 0 )
    {
     SLang_verror (SL_INVALID_PARM, "\n Incorrect parameters!\n ");
     return -1 ;
    }

    ......
    .............

Where THE INSTRINSICS is defined as:
...

MAKE_INTRINSIC_O("apgn_store", apgn_store),
....

Thanks


--
Ben Duncan - Business Network Solutions, Inc. 336 Elton Road Jackson MS, 39212
"Never attribute to malice, that which can be adequately explained by stupidity"
       - Hanlon's Razor



[2007 date index] [2007 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]