On 9/1/19 9:58 PM,
woodb...@gmail.com wrote:
> On Sunday, September 1, 2019 at 2:39:57 PM UTC-5, Richard Damon wrote:
>>
>> Personally, I would be tempted to leave it as is. Making useful error
>> messages is generally good. Making the Error comment optional might make
>> some sense if the Error Condition is fully self documenting, but the
>> linkage between IEC559 and IEEE754 isn't inherently obvious.
>
> Right.
>
>> I might
>> even extend the error message to something more verbose, like
>>
>> IEEE754/IEC559 Floating point assumed and needed
>
> I don't like having iec559 in there. If they want
> they can look at the line for more info. I agree in
> principle that that's a better message. On the other
> hand, some say this isn't likely to assert very often
> so the error message may not be that important.
>
>>
>> After all, a static_assert imposes zero run time costs, just minimal
>> text space in the file and virtually zero processing time during
>> compilation. Treat it as file documentation for the requirements of the
>> system, and make it readable.
>
The one purpose of IEC559 in the message is that that is what the
language calls it, so including it in the message might be useful.
My main thought is why work hard to coming up with a minimal message
when there is NO run time cost to the fuller message. The string
shouldn't even be included in the image, as static_assert generates no
code. Yes, the message may be never seen, but if it IS seen, it would
seem best to make it clear. The expected output (but I don't think
required) is printing the message, and maybe the condition that was
false as part of the error message. My preference would be that the
message be fairly self explanatory by itself.
Yes, they can go to the source code to read a comment near by, and maybe
even that happens somewhat automatically if they are building in an IDE,
but the less you assume about the environment, the better for the user.
If the message is clear, the user might realize without needing to dig
into the code, that they need to invoke the build with a flag to use IEC559.
It would be nice if in the vicinity of the static_assert was some
comments explaining WHY you have such a statement in the code, in case
someone on a machine that doesn't support it tries to use it, so they
can figure out if they want to try to remove the assumptions in the code
or if they need to try to find another package.