• Changed Behaviour on Tcl_Alloc in tcl9, howto port ?

    From Michael Niehren@michael@niehren.de to comp.lang.tcl on Fri Oct 4 10:54:38 2024
    From Newsgroup: comp.lang.tcl

    Hi,

    i am trying to port an C-Module to tcl9. In the module there has been used a call to Tcl_Alloc to allocate memory for an char* variable dest_buf.
    dest_buf = Tcl_Alloc(dest_size);

    Now on tcl9 Tcl_Alloc has an return type of void, on tcl8 it has char*, so i got the error: error: invalid conversion from ‘void*’ to ‘char*’

    I did not find something about that in the migration guide.

    Any ideas for resovling this issue ?

    best regards
    Michael

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Rich@rich@example.invalid to comp.lang.tcl on Fri Oct 4 12:33:35 2024
    From Newsgroup: comp.lang.tcl

    Michael Niehren <michael@niehren.de> wrote:
    Hi,

    i am trying to port an C-Module to tcl9. In the module there has been used a call to Tcl_Alloc to allocate memory for an char* variable dest_buf.
    dest_buf = Tcl_Alloc(dest_size);

    Now on tcl9 Tcl_Alloc has an return type of void, on tcl8 it has char*, so i got the error: error: invalid conversion from ‘void*’ to ‘char*’

    I did not find something about that in the migration guide.

    Any ideas for resovling this issue ?

    Possibly casting the void pointer to char*?:

    dest_buf = (char*)Tcl_Alloc(dest_size);

    --- Synchronet 3.20a-Linux NewsLink 1.114