Date: Tue, 19 Jan 2021 22:13:48 +0200
On Tue, 19 Jan 2021 at 22:06, Jake Arkinstall via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> Hi everyone.
>
> I've been thinking about this for a while now, and from some conversations I've had about it, I believe there could be some interest - but that, of course, won't happen without a proposal. So here goes. What I hope to be my first proposal.
>
> The idea is straightforward. Through static_assert, we can already opt to provide fixed (string literal) messages to the build log upon assertion failure. We cannot, however, opt to provide contextual information, such as the values of constant expressions that lead to the failure, without compiler-specific tricks. This can make debugging failed static assertions more complicated than I believe it could otherwise be.
>
> My proposed solution is to introduce a static_printf, a compile-time version of printf. Output is directed to the compiler's stdout, just as the message for a static_assert is upon failure, but utilising printf formatting. It has no effect on the output binary (except in the case of a formatting error).
Such as http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0596r0.html ?
<std-proposals_at_[hidden]> wrote:
>
> Hi everyone.
>
> I've been thinking about this for a while now, and from some conversations I've had about it, I believe there could be some interest - but that, of course, won't happen without a proposal. So here goes. What I hope to be my first proposal.
>
> The idea is straightforward. Through static_assert, we can already opt to provide fixed (string literal) messages to the build log upon assertion failure. We cannot, however, opt to provide contextual information, such as the values of constant expressions that lead to the failure, without compiler-specific tricks. This can make debugging failed static assertions more complicated than I believe it could otherwise be.
>
> My proposed solution is to introduce a static_printf, a compile-time version of printf. Output is directed to the compiler's stdout, just as the message for a static_assert is upon failure, but utilising printf formatting. It has no effect on the output binary (except in the case of a formatting error).
Such as http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0596r0.html ?
Received on 2021-01-19 14:14:01