ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> tcl-core
tcl-core
Re: [TCLCORE] Delaying CVF#340 until dec 5 (Re: CFV TIP #340)
by Joe English other posts by this author
Nov 27 2008 11:59AM messages near this date
Re: [TCLCORE] Delaying CVF#340 until dec 5 (Re: CFV TIP #340) | Re: [TCLCORE] Delaying CVF#340 until dec 5 (Re: CFV TIP #340)
Jan Nijtmans wrote:
> 
>  [ Revised specification for TIP#340, of which I approve ]

Just a few notes:

>  It will still be a lot of
>  work to check all Tcl_SetResult() calls, because
>  a simple change to Tcl_SetStringResult() is not
>  always the best solution. (I hope that Joe will
>  help me with this.....)

To clarify: this is not a mechanical change, but
the whole point of enabling additional compiler warnings --
to improve the code -- involves a certain degree of code
review in the first place.

Tcl_SetResult(interp, s, TCL_STATIC|TCL_VOLATILE);
can generally be shortened to Tcl_SetStringResult(interp, s);
without further thought.

In the case of Tcl_SetResult(interp, (char*)s, TCL_STATIC|TCL_VOLATILE);
where "s" is a const char *, you can also remove the cast-away-const cast.

Calls that use TCL_DYNAMIC or a general freeProc need to be
examined on a case-by-case basis.

Also: this is not a forced change; it requires no changes
to extensions or (strictly speaking) even to the core itself.
The idea is to provide a convenient, const-correct alternative
to Tcl_SetResult() for the benefit of code that wishes to become
const- and -Wwrite-strings safe.


>  The disadvantage is that it might break extensions
>  compiled against Tcl 8.6 which still use interp->result,
>  but since TIP #330 is accepted, who cares!

To clarify: such extensions are already broken and
have been in danger of the brokenness being exposed
at any time anyway.  Extensions that look directly
at interp-> result may be affected simply because there
will be even fewer places in the core that set interp-> result;
this sort of thing has been going on since Tcl 8.0,
so there's nothing new here.


--Joe English

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tcl-Core mailing list
Tcl-Core@[...].net
https://lists.sourceforge.net/lists/listinfo/tcl-core
Thread:
Jan Nijtmans
Jan Nijtmans
Pat Thoyts
Donal K. Fellows
Kevin Kenny
Joe English
Jan Nijtmans
Jan Nijtmans
Joe English
Jan Nijtmans
Kevin Kenny

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved