Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #112: The monitor is plugged into the serial port


comp / comp.lang.tcl / Changed Behaviour on Tcl_Alloc in tcl9, howto port ?

SubjectAuthor
* Changed Behaviour on Tcl_Alloc in tcl9, howto port ?Michael Niehren
`- Re: Changed Behaviour on Tcl_Alloc in tcl9, howto port ?Rich

1
Subject: Changed Behaviour on Tcl_Alloc in tcl9, howto port ?
From: Michael Niehren
Newsgroups: comp.lang.tcl
Organization: www.abavia.com
Date: Fri, 4 Oct 2024 08:54 UTC
From: michael@niehren.de (Michael Niehren)
Subject: Changed Behaviour on Tcl_Alloc in tcl9, howto port ?
Newsgroups: comp.lang.tcl
Reply-To: michael@niehren.de
Date: Fri, 04 Oct 2024 10:54:38 +0200
User-Agent: KNode/0.10.9
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8Bit
Message-ID: <nnd$2832e588$11fb2c3a@810f40c4fb7ed14c>
Organization: www.abavia.com
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!tncsrv06.tnetconsulting.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feed.abavia.com!abe007.abavia.com!abp003.abavia.com!reseller!not-for-mail
Lines: 17
Injection-Date: Fri, 04 Oct 2024 10:54:39 +0200
Injection-Info: reseller; mail-complaints-to="abuse@abavia.com"
View all headers

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

Subject: Re: Changed Behaviour on Tcl_Alloc in tcl9, howto port ?
From: Rich
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Fri, 4 Oct 2024 12:33 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: rich@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: Changed Behaviour on Tcl_Alloc in tcl9, howto port ?
Date: Fri, 4 Oct 2024 12:33:35 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <vdonav$7joa$1@dont-email.me>
References: <nnd$2832e588$11fb2c3a@810f40c4fb7ed14c>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 04 Oct 2024 14:33:36 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="ea19021a11bb05eb897007b6968d7f36";
logging-data="249610"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/RORRvtdN8Q2rjzLoowpD4"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.139 (x86_64))
Cancel-Lock: sha1:vpbfW4eZqYMM9fEoEX24+o4gJoM=
View all headers

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);

1

rocksolid light 0.9.8
clearnet tor