Comment by lerno
3 months ago
I think that one is a bit wrong, I must have written it many years ago. There are machines where pointers do have different address spaces, like the Arduino obviously, but that support isn't in the language yet, and maybe there might be issues there but comparing something like `int` and `float` pointers, that shouldn't be UB. I'll look at that text.
Debug traps can be kept in optimized builds, you can always do something like "-O3 --safe=yes". Right now it's not possible to set it per function or module, but that might be added if there is demand for it.
Because C3 also has contracts, the plan is to step by step increase static analysis to catch more of the contract violations at compile time.
For example:
<*
@require a > 10
@require b < a
*>
fn void test(int a, int b) {}
Will error at compile time for `test(5, 2)` (first @require), or `test(5, 10)` (second @require). These will also be checked at runtime, but catching low hanging fruits a compile time will be very helpful I think.
LLVM address and thread sanitizers work. The memory sanitizer still has some issues but will be fixed.
Currently there are just cross platform threads available and some rudimentary thread pools. This needs to be expanded and we'll see if there are things the language could help with but there will not be any async built in.
if you plan to look at pointer provenance please check recent HN discussions like this one ( https://doc.rust-lang.org/std/ptr/index.html#exposed-provena.... What is relevant for C3 is that it is likely to be exposed to open issues from LLVM and people will need practical ways to solve them.
ps Don't take my word for it. My tldr might be wrong because of my gamedev experience (like we dont ship products with GCC).
In C casting a pointer to an int and back again used to be fine. Except later people want to track the pointer to do optimizations and things went... poorly.
I feel that this is a mess better addressed once there are actual implementations that you have to use, rather than the current state where people are still working out the details.