Tk Source Code

View Ticket
Login
Ticket UUID: 581682
Title: Cannot compile tk8.4 with DEBUG on VC60
Type: Bug Version: obsolete: 8.4a4
Submitter: schnulli0 Created on: 2002-07-15 13:40:03
Subsystem: 68. Win Window Operations Assigned To: dgp
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2002-07-17 20:54:28
Resolution: Invalid Closed By: dgp
    Closed on: 2002-07-17 13:54:28
Description:
I wanted to compile Tk with the NODEBUG option off, because my program
crashes when i try to exit it (not always but very often). As my program runs
correctly under Tk8.3.1 and Tk8.3.2 i assumed an error in the Windows part
of the code (no crashes with Tk8.4 under UNIX !!) or some incompatibility with
the recent Tk win code,  but ..

I cannot compile Tk8.4a4 under MS Windows 98 with the NODEBUG option off.
The offending code is in tkWinWindows.c. Apparently, the CONST char *string
is the culprit - when i make a cast to (char *)string in the Tcl_GetInt statement,
it would compile !
An error - or just my dumbness ??


int
TkpScanWindowId(interp, string, idPtr)
    Tcl_Interp *interp;         /* Interpreter to use for error reporting. */
    CONST char *string;         /* String containing a (possibly signed)
                                 * integer in a form acceptable to strtol. */
    Window *idPtr;              /* Place to store converted result. */
{
    Tk_Window tkwin;
    Window number;

    /*
     * We want sscanf for the 64-bit check, but if that doesn't work,
     * then Tcl_GetInt manages the error correctly.
     */
    if (
#ifdef _WIN64
        (sscanf(string, "0x%p", &number) != 1) &&
#endif
        Tcl_GetInt(interp, string, (int *)&number) != TCL_OK) {  <===== ERROR ?
        return TCL_ERROR;
    }

    tkwin = Tk_HWNDToWindow((HWND)number);
    if (tkwin) {
        *idPtr = Tk_WindowId(tkwin);
    } else {
        *idPtr = None;
    }
    return TCL_OK;
}
User Comments: dgp added on 2002-07-17 20:54:28:
Logged In: YES 
user_id=80530


If you get any warnings compiling the 8.4b1 release,
please attach them here.  If I can't make sense out
of them there are many native German speakers in
the Tcl world who can.

schnulli0 added on 2002-07-17 13:50:29:
Logged In: YES 
user_id=578365

Yes, you're right. After compiling TCL with NODEBUG first, I only get a warning (wrong types). It is in german and 
may not of great help for you (Falscher Typbezeichner const). Anyway, it compiles - problem solved.
Thanks

dgp added on 2002-07-15 22:13:38:
Logged In: YES 
user_id=80530


Can you reproduce the problem with the 8.4b1 release?

What is the error message from the compiler?

Tcl_GetInt(...) does take (CONST char *), so I don't think
your analysis is correct.

Hmmm.... is your copy of Tcl also compiled for debugging?
There may be some library mismatches if Tcl is non-debug
and Tk is debug.