Re: How can we allow using phobos with asserts/contracts?
On 10/18/21 8:35 AM, user1234 wrote: On Sunday, 17 October 2021 at 21:00:19 UTC, Steven Schveighoffer wrote: On 10/16/21 6:47 PM, solidstate1991 wrote: When I make this call ``` format(" %3.3f"w, avgFPS); ``` my program immediately crashes with an access violation error. The debugger out is different between x86 and x86-64. I've made all sanity checks, so I need some other suggestions. FYI, solidstate figured this out. It was because of an out-of-bounds index on `BitArray`. But that irks me. Why wouldn't `BitArray` do a bounds check? And then I remembered -- Phobos is built in release mode even when your app is not. I literally *cannot* request from the compiler that `BitArray` enforce its contracts without rebuilding the library completely. I never want to build code that doesn't have bounds checks. How can we fix this? contracts ? bound checks should be in the body and conditionally compiled with `version(D_NoBoundsChecks){} else {}` then same problem because it's not a function template I guess. someone should make it a function template then. Even a template may not help, if the compiler decides it's already been instantiated. -Steve
Re: How can we allow using phobos with asserts/contracts?
On Sunday, 17 October 2021 at 21:00:19 UTC, Steven Schveighoffer wrote: On 10/16/21 6:47 PM, solidstate1991 wrote: When I make this call ``` format(" %3.3f"w, avgFPS); ``` my program immediately crashes with an access violation error. The debugger out is different between x86 and x86-64. I've made all sanity checks, so I need some other suggestions. FYI, solidstate figured this out. It was because of an out-of-bounds index on `BitArray`. But that irks me. Why wouldn't `BitArray` do a bounds check? And then I remembered -- Phobos is built in release mode even when your app is not. I literally *cannot* request from the compiler that `BitArray` enforce its contracts without rebuilding the library completely. I never want to build code that doesn't have bounds checks. How can we fix this? -Steve contracts ? bound checks should be in the body and conditionally compiled with `version(D_NoBoundsChecks){} else {}` then same problem because it's not a function template I guess. someone should make it a function template then.
How can we allow using phobos with asserts/contracts?
On 10/16/21 6:47 PM, solidstate1991 wrote: When I make this call ``` format(" %3.3f"w, avgFPS); ``` my program immediately crashes with an access violation error. The debugger out is different between x86 and x86-64. I've made all sanity checks, so I need some other suggestions. FYI, solidstate figured this out. It was because of an out-of-bounds index on `BitArray`. But that irks me. Why wouldn't `BitArray` do a bounds check? And then I remembered -- Phobos is built in release mode even when your app is not. I literally *cannot* request from the compiler that `BitArray` enforce its contracts without rebuilding the library completely. I never want to build code that doesn't have bounds checks. How can we fix this? -Steve