On 23.09.2006, at 13:37, Gustaf Neumann wrote:

Not sure, what's faster, resetResult() + setIntObj() or
setObjResult() + newIntObj(). The difference in speed is most likely
not significant. however, resetResult allows to append to the object,
clears error state, etc.

I believe that either/or is OK to use as both will be
almost the same as fast (or as slow). It is thus a
matter of personal taste wether to write:

  Tcl_ResetResult(interp):
  Tcl_SetIntObj(Tcl_GetObjResult(interp), 1);

or

  Tcl_SetObjResult(interp, Tcl_NewIntObj(1));

The only "problem" I have with the first case
is that is pretty "weird", as lots of assumptions
are made and code ist not that clear. But, as
said, people are free to use either/or.

I still have to go to tcl core-list and get this
one straighten out, as I would really like to know
wether:

  Tcl_SetIntObj(Tcl_GetObjResult(interp), 1);

constructs can be used w/o a side effect.
I guess, the main thing to ask is:

  Can Tcl_GetObjResult() return shared object?

Cheers
Zoran


Reply via email to