C++ Logo

std-discussion

Advanced search

Re: Opt-In Compile Time Bounds Checking

From: Levo DeLellis <levo.delellis_at_[hidden]>
Date: Sun, 30 Jul 2023 19:23:55 -0500
The compiler is online but not opened source. It seems like life would
be easier closed source for now. Here's a link to the bound check
page. https://bolinlang.com/highlights#ArrayBounds

> Safety and avoiding code crashes is vital in automotive and aviation.

There's no verification and I'm sure there's bugs in my compiler, I
would not trust it even after 1.0

> Re Ex 3 Have you implemented 'safespan'?

The check is mandatory in my language. Arrays, dynamic arrays and
slices all require the rules of the linked page to be followed for
access. Sieve of Eratosthenes is not fun in my language and may get
better in the future.

> Wouldn't that args[0][0] also need a safety check on the element args[0][N] just in case?

In my language it's required but you can't really do that for char*.
It'll likely be a pain in code that mixes with C since you'd need to
find the length (with strlen) to put it in a container. I don't really
see a point going that far at the moment since this is to assist being
safer and not trying to be completely safe.

On Sun, Jul 30, 2023 at 7:57 AM Jonny Grant via Std-Discussion
<std-discussion_at_[hidden]> wrote:
>
>
>
> On 28/07/2023 03:03, Levo DeLellis via Std-Discussion wrote:
> > Hi all. Last week I attended the CppNorth conference. I didn't realize there was much interest in safety with C++. I've been implementing a compiler that is slowly becoming memory safe so I thought maybe I should submit a series of proposals since I'm already familiar with potential pitfalls, solutions and implementation.
> >
> > Here's a basic proposal attached, it's a small step towards memory safety. Here I talk about opt-ing into a container that has bounds checking at compile time. If there's any interest in having this in the standard I'd be happy to write more about this and additional proposals going toward memory safety
> >
>
> Levo,
>
> Personally, it sounds interesting, have you published your compiler online?
>
> Safety and avoiding code crashes is vital in automotive and aviation.
>
> Re Ex 3 Have you implemented 'safespan'? Am I correct in thinking your compiler understands the implementation of that container, and would output a warning from static analysis for an 'invalidated' args access that hadn't been just been checked against args.size()? (since any change)
>
> Wouldn't that args[0][0] also need a safety check on the element args[0][N] just in case? in case there was an empty nul terminated string in the array of pointers (ie for another use, instead of relying upon main argv list having all non-empty strings)
>
> Regards, Jonny
> --
> Std-Discussion mailing list
> Std-Discussion_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion

Received on 2023-07-31 00:24:33