[slang-users] _NARGS is not set when calling an "overloaded" function (ie one set by __add_string)

Doug Burke dburke at cfa.harvard.edu
Mon Dec 19 11:23:57 EST 2005


John,

I can easily imaging that _NARGS is not meant to be set in the 
following situation, so I just wanted to know whether it was 
intentional behavior or a bug. The following is with S-Lang 2.0.5 on a 
OS-X machine:

slsh> typedef struct { a } A_Type;
slsh> p.a = 43;
slsh> p;
A_Type with 1 fields

I now define a routine for customizing the string representation of 
this type:

slsh> define A_string (x) { sprintf ("A_Type: a=%S (_NARGS=%d)", x.a, 
_NARGS); }

If I call it directly then _NARGS is set:

slsh> A_string (p);
A_Type: a=43 (_NARGS=1)

However, if the routine is called "indirectly", then _NARGS is not set:

slsh> __add_string (A_Type, &A_string);
slsh> p;
A_Type: a=43 (_NARGS=0)

Doug





More information about the slang-users-l mailing list