Comment by SleepyMyroslav
3 months ago
Judging from 'comparing pointers of different provenance' can produce 'any result' ( here https://c3-lang.org/language-rules/undefined-behaviour/#list... ) everyone has to deal with it.
More low effort questions. Question about optional debug traps: are they available in optimized builds? Are any LLVM sanitizers available? It usually means language needs to have APIs to mark up your own allocators/containers/etc.
Does language help parallel/concurrent programs to be more readable?
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:
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.
> Question about optional debug traps
Contracts are available in safe mode, which can optionally be enabled for optimised builds as-well, yes.
> Does language help parallel/concurrent programs to be more readable?
There's active interest in working in this area, if you're interested to help you're welcome to suggest or contribute.