Date: Wed, 26 Mar 2025 11:06:04 -0500
Is this relevant anymore given contracts?
Cheers,
Jeremy
On Wed, Mar 26, 2025 at 09:40 Frederick Virchanza Gotham via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> Today my compiler gave me the following output:
>
> md5.hpp:244:21: error: call to non-‘constexpr’ function ‘void
> __assert_fail(const char*, const char*, unsigned int, const char*)’
> 244 | assert( 0u == (*ptr >> 8u) );
>
>
> We should be able to use 'assert' in a constexpr function. If the
> function is invoked at compile time (instead of runtime), then it
> should be as if the 'assert' was never there. This would be the
> easiest way of doing it.
>
> A more complicated way of doing it would be to get the compiler at
> compile time to actually evaluate the assertion, and to cease
> compiling if the assertion fails -- this would be ideal.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
Cheers,
Jeremy
On Wed, Mar 26, 2025 at 09:40 Frederick Virchanza Gotham via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> Today my compiler gave me the following output:
>
> md5.hpp:244:21: error: call to non-‘constexpr’ function ‘void
> __assert_fail(const char*, const char*, unsigned int, const char*)’
> 244 | assert( 0u == (*ptr >> 8u) );
>
>
> We should be able to use 'assert' in a constexpr function. If the
> function is invoked at compile time (instead of runtime), then it
> should be as if the 'assert' was never there. This would be the
> easiest way of doing it.
>
> A more complicated way of doing it would be to get the compiler at
> compile time to actually evaluate the assertion, and to cease
> compiling if the assertion fails -- this would be ideal.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
Received on 2025-03-26 16:06:19