CTFE for array / string / slice operations, constant propagation and bug detection at compile time
Paul Backus
snarwin at gmail.com
Sun May 14 13:49:29 UTC 2023
On Saturday, 13 May 2023 at 19:21:30 UTC, Cecil Ward wrote:
> Would it be a nightmare to implement CTFE for arrays, slices
> and strings? Optimisation of basic operations on these types,
> in respect of concatenation, slicing and many more operations
> would be extremely welcome. Would there possibly be a chance to
> catch many bugs at compile-time?
As a point of comparison, it looks like neither gcc nor clang
catch this kind of error in C code, even with every relevant
warning flag I could find enabled:
https://godbolt.org/z/r5Tahe5YW
I'm not an expert, but my guess would be that if neither clang
nor gcc implement this check, it's probably at least a little
tricky to do.
More information about the Digitalmars-d
mailing list