.
D 2025-11-17T16:40:03.545
L branch/c-std-update
N text/x-markdown
P 4c96ea7c8629917b754438133f23a4d1ad643b9103ae887352f3568890300925
U dkf
W 3554
This branch is looking at the things we can do by adopting C11 features (as opposed to just C89) more consistently.
The following branches (organised by enabling underlying language feature) are (mostly) _derived_ from this one. They're organised by the basic underlying enabling feature of C11 that permits them:
* __Feature: Anonymous Structure Members__
* [`c11-anon-members`](https://core.tcl-lang.org/tcl/timeline?r=c11-anon-members)
* __Feature: Booleans__
* [`c11-bool`](https://core.tcl-lang.org/tcl/timeline?r=c11-bool)
* __Feature: Comments with //__
* There is no branch for changing comment styles (`/* ... */` to `// ...`); we _can,_ but it makes no sense to prioritise doing so at all and it makes only the smallest of readability difference. Change when it makes sense to do it as part of some other activity, not before. (Note however that this comment style has been sneaking into Tcl for some time; it crops up in quite a few places in the 9.0 codebase.)
* __Feature: Flexible Variable Declarations__
* [`c11-tcloo-foreach`](https://core.tcl-lang.org/tcl/timeline?r=c11-tcloo-foreach)
* [`c11-full-hash-foreach`](https://core.tcl-lang.org/tcl/timeline?r=c11-full-hash-foreach) (extended version)
* Moving variable declarations around inside functions isn't very high value and yet is *very* noisy. Outside of doing things like making iteration neater (in the branches above, where the demonstrated gains are stronger), it's not worth putting a lot of effort into specifically, but can easily be done incrementally as part of other work.
* __Feature: Inline Functions__
* Widely used in Tcl for many years.
* __Feature: New Types__
* We ought to support `<stdint.h>` more, especially in `tclLink.c`. (This would also be a good opportunity for using type-generic trickery.)
* We can ignore complex numbers entirely; we were doing that already anyway.
* The alignment type `max_align_t` would be useful, but isn't supported by MSVC for obscure reasons.
* __Feature: Type-Generic Functions__
* [`c11-generic-oo-api`](https://core.tcl-lang.org/tcl/timeline?r=c11-generic-oo-api); _public API change._
* This would be a useful thing to use with `tclLink.c`; that's also a public API change.
* __Feature: Non-Constant Compound Values__
* [`c11-array-literals`](https://core.tcl-lang.org/tcl/timeline?r=c11-array-literals)
* Note that [`c11-tcloo-foreach`](https://core.tcl-lang.org/tcl/timeline?r=c11-tcloo-foreach) also uses this feature to get the declaration semantics right.
* __Feature: Restrict Qualification of Function Arguments__
* Compilers tend to handle most of our functions by assuming restriction based on argument types. There's a few places it might be worthwhile.
* __Feature: Varargs Macros__
* [`c11-automarker`](https://core.tcl-lang.org/tcl/timeline?r=c11-automarker)
* [`c11-printf-result`](https://core.tcl-lang.org/tcl/timeline?r=c11-printf-result)
* [`c11-tebc-trace-cleanup`](https://core.tcl-lang.org/tcl/timeline?r=c11-tebc-trace-cleanup) ✓
* [`c11-varargs-nr-add-callback`](https://core.tcl-lang.org/tcl/timeline?r=c11-varargs-nr-add-callback)
* __Feature: Variable Length Arrays__
* Not recommended for use. Compiler support is far too patchy and we explicitly don't want to stress the C stack.
Note! None of these changes are altering the public API (or ABI) of Tcl. It is our intention to keep that working with a wider range of C versions, as well as with C++ and Objective-C (either of which may be used internally by Tk).
Z 802d757f5709f388528c138150d1bedd