tag:blogger.com,1999:blog-2420869991974935734.post405396900111364657..comments2023-07-02T17:04:56.386+02:00Comments on Krister Walfridsson’s old blog: GCC __attribute__((pure)) and C++ exceptionsKrister Walfridssonhttp://www.blogger.com/profile/02591279630933941271noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-2420869991974935734.post-82219477097308371832017-02-21T23:31:51.588+01:002017-02-21T23:31:51.588+01:00In many cases, a guarantee of semantically-precise...In many cases, a guarantee of semantically-precise error trapping would seem simultaneously expensive and unnecessary. Optimization could be greatly enhanced by allowing programmers to specify regions of loose exception semantics: if one operations within such a region could not affect the other in any way other than by throwing an exception, a compiler may overlap the operations in any fashion it sees fit. In the event that two or more operations would throw an exception, the compiler could choose among them in Unspecified fashion.<br /><br />Such optimizations should generally be limited to programmer-designated regions, though it may be useful to have a (non-conforming) command-line option to automatically behave as though every function in a particular source file was thus marked. If a programmer wouldn't care which exception gets throws, or whether the throw prevents the execution of some other code which would have no side-effects, reducing code efficiency for the purpose of upholding such semantics would be wasteful. Allowing the programmer to waive such semantics would eliminate such waste.supercathttps://www.blogger.com/profile/12531904492602532373noreply@blogger.com