Check-in [cf60913448]

Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Slight formatting, and adding a link to the related Sqlite change.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: cf609134487e17461497299e43ae0714655c9a8a3e0014054026e1f3a8b928d6
User & Date: jan.nijtmans 2018-08-23 15:22:39.263
Context
2018-08-24
12:18
Add Tcl_GetWideIntFromObj() description of change. check-in: 84e714bd8c user: jan.nijtmans tags: trunk
2018-08-23
15:22
Slight formatting, and adding a link to the related Sqlite change. check-in: cf60913448 user: jan.nijtmans tags: trunk
13:27
missing minus sign (quite important ....) check-in: 5441fa571a user: jan.nijtmans tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to tip/494.md.
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
If the return value of such function is directly used in a compare, this could lead to the use of an unsigned compare in stead of a signed compare.
If you compile your extension with -D_TCL\_8\_COMPAT_, those 10 functions will be changed to wrapper macro's which makes everything behave as if those functions return Tcl_WideInt. That's the easiest way to resolve this potential problem.

There are 2 other ways to make this change, which can do it without the use of the _TCL\_8\_COMPAT_ macro:

  * Add _1_ to the left and right hand side of the comparison. E.g. [as here](https://core.tcl.tk/tk/fdiff?v1=100235897e9cf359&v2=9cf86629040df0d3)

  * Don't compare to -1 using < or >, but only using == or !=. You can get rid of the compiler warning using casts to _size\_t_. E.g. [as here](https://core.tcl.tk/tk/fdiff?v1=207c608cec63f8f0&v2=e2e5d2322beea420)

Tk and sqlite are already converted to make full use of TIP #494. Other extensions included with Tcl (e.g. tdbc) are unaffected.

# Implementation

The implementation of this TIP can be found in the [memory-API branch]
(https://core.tcl.tk/tcl/timeline?r=memory-API).

# Copyright







|

|







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
If the return value of such function is directly used in a compare, this could lead to the use of an unsigned compare in stead of a signed compare.
If you compile your extension with -D_TCL\_8\_COMPAT_, those 10 functions will be changed to wrapper macro's which makes everything behave as if those functions return Tcl_WideInt. That's the easiest way to resolve this potential problem.

There are 2 other ways to make this change, which can do it without the use of the _TCL\_8\_COMPAT_ macro:

  * Add _1_ to the left and right hand side of the comparison. E.g. [as here](https://core.tcl.tk/tk/fdiff?v1=100235897e9cf359&v2=9cf86629040df0d3)

  * Don't compare to -1 using < or >, but only using == or !=. You can get rid of the (Tcl 8.x) compiler warnings using casts to _(size\_t)_, for Tcl-9-only compiles one of the casts is not necessary any more. E.g. [as here](https://core.tcl.tk/tk/fdiff?v1=207c608cec63f8f0&v2=e2e5d2322beea420)

Tk and [sqlite](http://cyqlite.sourceforge.net/cgi-bin/sqlite/info/17c148b94008df81) are already converted to make full use of TIP #494. Other extensions included with Tcl (e.g. tdbc) are unaffected.

# Implementation

The implementation of this TIP can be found in the [memory-API branch]
(https://core.tcl.tk/tcl/timeline?r=memory-API).

# Copyright