On Monday 25 November 2024 00:39:37 Pacific Standard Time Schimkowitsch Robert 
wrote:
> Well, my idea was mostly to test extreme cases in constexpr context, so you
> get compiler errors if you overlooked something and e.g. cause unsigned
> wraparound when getting passed int_max. 

That should be done in unit testing, wherever possible. Some conditions we 
simply can't test, such as *succeeding* in allocating a memory block of a size 
comparable to PTRDIFF_MAX because such a block is not architecturally possible 
(on 64-bit machines). As a rule of thumb for test writers: always test your 
boundary conditions.

> But as mentioned above, the number
> of useful functions I can write constexpr is probably limited. I believe
> Herb rather meant this example to show that it is possible to reduce the
> amount of UB allowed in the language.


-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Principal Engineer - Intel DCAI Platform & System Engineering

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to