Author: Jan Nijtmans <[email protected]> State: Draft Type: Project Vote: Done Created: 13-Dec-2019 Post-History: Keywords: Tcl Tcl-Version: 8.7 Tcl-Branch: cplusplus
Every once in a while there is a request to be able to compile Tcl with a C++ compiler. This would - in theory - allow C++ exceptions thrown by extensions to be handled by Tcl. This TIP is not about adding any code to Tcl doing that. But - as a first step - at least, Tcl needs to compile well with a C++ compiler even though we don't use any C++ features.
This TIP proposes making Tcl compilable with a C++ compiler, without actually using any C++ features.
The Tcl source-code has been strictified in the following ways:
No C++ keywords are allowed any more, such as
class, for variable names.
No automatic casts from
(void *)to other types any more, so all malloc's must be preceded by a type casts. And a
clientDatavariable cannot be assigned directly any more to a variable of another type. This situation requires a type cast from now on in the Tcl core.
Travis build sections are added, which compile Tcl with g++ (UNIX/Windows). So, any future commit which violates C++ compilation will lead to a failed build.
Nothing is done yet in the Tcl code to handled C++ exception, neither is any of the API now available as C++ classes.
This document has been placed in the public domain.