Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 4a403070a8a7f5e459a8c22cfd911c050550feb88a4604043e434f5dcf43d553
Ticket: 1e48483c8b3b2702b981ebcc85474512bb3d6e0d
Use of non-standard C code in TCLBOOLWARNING
User & Date: jan.nijtmans on 2024-04-26 11:32:55
Changes

  1. icomment:
    Thanks for the suggestion. I tried it:
    <pre>
    warning: identifier ‘static_assert’ conflicts with C++ keyword [-Wc++-compat]
     2787 |                 if (Tcl_GetBooleanFromObj(interp, objv[1], &debugType)+ (int)(sizeof(struct {static_assert(sizeof(debugType) <= sizeof(int),"all is lost");int dummy;})*0)
          |                                                                                              ^~~~~~~~~~~~~
    warning: defining type in ‘sizeof’ expression is invalid in C++ [-Wc++-compat]
     2787 |                 if (Tcl_GetBooleanFromObj(interp, objv[1], &debugType)+ (int)(sizeof(struct {static_assert(sizeof(debugType) <= sizeof(int),"all is lost");int dummy;})*0)
          |                                                                                      ^~~~~~
    
    </pre>
    
    So, I changed it to _Static_assert(), that fixed the first warning but not the second. Conclusion: Your suggestion won't work when tcl.h is included in a C++ project.
    
  2. login: "jan.nijtmans"
  3. mimetype: "text/x-fossil-wiki"