Re: Tcl dumps when creating string rep for custom type



Anders Moe wrote:
> I've registered my own type using Tcl_RegisterObjType,
....
> set g [test] ; # test is the command used to create the object
> puts $g ; # OK - creates a string rep, works fine
> set g oo ; # DUMPS
....
> void update_string_repr (Tcl_Obj* obj)
> {
> char* c = "test string\0";
> obj->bytes = c;
> obj->length = strlen (c);
> }

Let's review the Tcl_RegisterObjType documentation:

The updateStringProc member...
... Storage for the byte array must be allocated in
the heap by Tcl_Alloc or ckalloc. ...

Note that your code does not do what the docs require.

--
| Don Porter Mathematical and Computational Sciences Division |
| donald.porter@xxxxxxxx Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|
.



Relevant Pages

  • Re: My XP OS is corrupted in VPC v. 7; what does MS expect me to do?
    ... please make no assumptions regarding my review. ... encompassed the entirety of my review of VirtualPC. ... I also find the documentation accompanying VPC to be skimpy and lacking ... Again, thanks for all the replies and I will continue to look for more, ...
    (microsoft.public.mac.virtualpc)
  • Re: small teams knowledge/document management issue
    ... every peice of project documentation is also thoroughly reviewed. ... reports, technical specifications, schematics, BOM, test reports, quality ... A Review Record Form. ... you were running a Windows based system I would recommend MKS Source ...
    (comp.arch.embedded)
  • Re: Sodding Word
    ... I have some idea that sort of thing might come back one of these days. ... I'm afraid that is a good description of the documentation. ... I remember a review in a ... him from the first window, ...
    (uk.comp.sys.mac)
  • Re: VERY Confusing Notation in FFT Documentation
    ... Yes -- sloppy, ambiguous, and inconsistent wording is rampant in their ... documentation. ... comment and say they'll review it for the next version. ... What version were you referring to? ...
    (comp.soft-sys.matlab)
  • Re: Purebasic Review: Please?
    ... >> review of the product? ... >> bitmaps, joystick, etc). ... my advice to the PureBasic ... team would be to get the documentation in order before ...
    (comp.lang.basic.misc)