Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #120652 > unrolled thread

"Safe C++ is A new Proposal to Make C++ Memory-Safe"

Started byLynn McGuire <lynnmcguire5@gmail.com>
First post2024-10-08 20:40 -0500
Last post2024-11-30 10:03 -0500
Articles 4 on this page of 84 — 14 participants

Back to article view | Back to comp.lang.c++


Contents

  "Safe C++ is A new Proposal to Make C++ Memory-Safe" Lynn McGuire <lynnmcguire5@gmail.com> - 2024-10-08 20:40 -0500
    Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Michael S <already5chosen@yahoo.com> - 2024-10-09 14:14 +0300
    Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Lynn McGuire <lynnmcguire5@gmail.com> - 2024-10-09 15:02 -0500
      Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Michael S <already5chosen@yahoo.com> - 2024-10-09 23:46 +0300
        Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Muttley@DastartdlyHQ.org - 2024-10-10 08:34 +0000
          Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Michael S <already5chosen@yahoo.com> - 2024-10-10 12:51 +0300
            Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Muttley@DastartdlyHQ.org - 2024-10-10 10:20 +0000
              Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Michael S <already5chosen@yahoo.com> - 2024-10-10 13:44 +0300
                Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Muttley@DastartdlyHQ.org - 2024-10-10 10:50 +0000
                  Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Michael S <already5chosen@yahoo.com> - 2024-10-10 14:10 +0300
                    Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Muttley@DastartdlyHQ.org - 2024-10-10 13:11 +0000
                      Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Michael S <already5chosen@yahoo.com> - 2024-10-10 16:54 +0300
                        Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Paavo Helde <eesnimi@osa.pri.ee> - 2024-10-10 18:08 +0300
                          Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" wij <wyniijj5@gmail.com> - 2024-10-10 23:37 +0800
                            Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Paavo Helde <eesnimi@osa.pri.ee> - 2024-10-10 19:03 +0300
                          Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Michael S <already5chosen@yahoo.com> - 2024-10-10 19:11 +0300
                            Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" David Brown <david.brown@hesbynett.no> - 2024-10-10 20:01 +0200
            Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-10-10 07:56 -0700
              Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Michael S <already5chosen@yahoo.com> - 2024-10-10 18:56 +0300
      Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Ross Finlayson <ross.a.finlayson@gmail.com> - 2024-10-20 10:13 -0700
    Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" jseigh <jseigh_es00@xemaps.com> - 2024-10-10 12:13 -0400
    Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Bonita Montero <Bonita.Montero@gmail.com> - 2024-10-10 18:29 +0200
    Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Vir Campestris <vir.campestris@invalid.invalid> - 2024-10-20 12:37 +0100
      Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Michael S <already5chosen@yahoo.com> - 2024-10-20 14:46 +0300
        Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Muttley@DastartdlyHQ.org - 2024-10-20 14:23 +0000
    Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" jseigh <jseigh_es00@xemaps.com> - 2024-10-27 19:09 -0400
      Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" jseigh <jseigh_es00@xemaps.com> - 2024-10-27 20:40 -0400
        Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" wij <wyniijj5@gmail.com> - 2024-10-28 09:22 +0800
          Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-10-27 21:18 -0700
            Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" jseigh <jseigh_es00@xemaps.com> - 2024-10-28 12:25 -0400
              Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" jseigh <jseigh_es00@xemaps.com> - 2024-10-30 12:56 -0400
                Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-10-30 12:50 -0700
                  Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" jseigh <jseigh_es00@xemaps.com> - 2024-10-30 16:31 -0400
                    Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-04 12:47 -0800
                Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" jseigh <jseigh_es00@xemaps.com> - 2024-11-07 07:02 -0500
                Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Lynn McGuire <lynnmcguire5@gmail.com> - 2024-11-07 20:14 -0600
                  Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" jseigh <jseigh_es00@xemaps.com> - 2024-11-08 09:40 -0500
                  Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" scott@slp53.sl.home (Scott Lurndal) - 2024-11-08 14:48 +0000
                    Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Muttley@DastartdlyHQ.org - 2024-11-08 14:54 +0000
                      Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-08 12:40 -0800
                        Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Muttley@dastardlyhq.com - 2024-11-09 12:01 +0000
                          Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-09 12:39 -0800
                            Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Muttley@DastartdlyHQ.org - 2024-11-11 09:56 +0000
                              Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-11 13:36 -0800
                                Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Muttley@DastartdlyHQ.org - 2024-11-12 08:28 +0000
                                  Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-12 13:56 -0800
                                    Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-12 13:59 -0800
                                    Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Ross Finlayson <ross.a.finlayson@gmail.com> - 2024-11-12 16:20 -0800
                        Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Ross Finlayson <ross.a.finlayson@gmail.com> - 2024-11-10 13:02 -0800
                          Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Ross Finlayson <ross.a.finlayson@gmail.com> - 2024-11-10 13:05 -0800
                      Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-08 12:46 -0800
                        Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" wij <wyniijj5@gmail.com> - 2024-11-09 05:18 +0800
                          Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-08 13:23 -0800
                          Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" wij <wyniijj5@gmail.com> - 2024-11-09 05:25 +0800
                          Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-08 13:27 -0800
                            Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" wij <wyniijj5@gmail.com> - 2024-11-09 06:02 +0800
                              Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-08 14:09 -0800
                                Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" wij <wyniijj5@gmail.com> - 2024-11-09 06:35 +0800
                                  Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-08 14:37 -0800
                                    Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" wij <wyniijj5@gmail.com> - 2024-11-09 06:47 +0800
                                      Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-08 14:58 -0800
                                        Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" wij <wyniijj5@gmail.com> - 2024-11-09 07:09 +0800
                                          Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-08 15:35 -0800
                                            Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" scott@slp53.sl.home (Scott Lurndal) - 2024-11-08 23:50 +0000
                                              Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-08 18:11 -0800
                                  Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-08 14:39 -0800
                                    Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" wij <wyniijj5@gmail.com> - 2024-11-09 06:58 +0800
                                      Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-08 15:01 -0800
                                        Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" wij <wyniijj5@gmail.com> - 2024-11-09 07:13 +0800
                                          Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-08 15:40 -0800
                                            Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" wij <wyniijj5@gmail.com> - 2024-11-09 08:19 +0800
                                              Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-08 18:15 -0800
                                                Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" scott@slp53.sl.home (Scott Lurndal) - 2024-11-09 16:23 +0000
                                                  Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-09 12:42 -0800
                                                    Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" scott@slp53.sl.home (Scott Lurndal) - 2024-11-09 23:23 +0000
                                                      Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Paavo Helde <eesnimi@osa.pri.ee> - 2024-11-10 11:00 +0200
                                                        Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-12 16:56 -0800
                                                          Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-12 16:59 -0800
                                                            Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-12 17:05 -0800
                                            Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Muttley@dastardlyhq.com - 2024-11-09 12:01 +0000
                                    Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Muttley@dastardlyhq.com - 2024-11-09 12:01 +0000
                                      Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-11-09 12:50 -0800
      Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-11-04 06:59 -0800
    Re: "Safe C++ is A new Proposal to Make C++ Memory-Safe" jseigh <jseigh_es00@xemaps.com> - 2024-11-30 10:03 -0500

Page 5 of 5 — ← Prev page 1 2 3 4 [5]


#120873

FromMuttley@dastardlyhq.com
Date2024-11-09 12:01 +0000
Message-ID<vgniu9$3p4u6$1@dont-email.me>
In reply to#120857
On Fri, 8 Nov 2024 14:39:28 -0800
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
>On 11/8/2024 2:35 PM, wij wrote:
>> If so, use pthread to invent what you want, in stead of too many 'weird'
>modifications.
>> All are confined in your source. it should be easier to manage and less work
>and errors.
>> 
>
>I used to use Pthreads all the time, and resort to asm for the lock-free 
>bits... They were for pre C/C++11 impls. The damn DWCAS issue is 

Using assembler is not very portable (and not even backwards compatible with
older CPU generations depending on op codes) and future maintenance devs won't 
thank you for it.

[toc] | [prev] | [next] | [standalone]


#120877

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2024-11-09 12:50 -0800
Message-ID<vgohud$3v1o1$3@dont-email.me>
In reply to#120873
On 11/9/2024 4:01 AM, Muttley@dastardlyhq.com wrote:
> On Fri, 8 Nov 2024 14:39:28 -0800
> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
>> On 11/8/2024 2:35 PM, wij wrote:
>>> If so, use pthread to invent what you want, in stead of too many 'weird'
>> modifications.
>>> All are confined in your source. it should be easier to manage and 
>>> less work
>> and errors.
>>>
>>
>> I used to use Pthreads all the time, and resort to asm for the lock- 
>> free bits... They were for pre C/C++11 impls. The damn DWCAS issue is 
> 
> Using assembler is not very portable (and not even backwards compatible 
> with
> older CPU generations depending on op codes) and future maintenance devs 
> won't thank you for it.
> 

It's not portable at all! Indeed. :^)

Fwiw, I used to use it (asm intel/sparc/ppc) for sensitive algorithms 
way _before_ C/C++11 came out. Then, I started thinking about porting 
them to the pure portable and new C/C++ std. It's a shame that DWCAS is 
not fully available as always lock free on arch's that support it... 
Shit happens. But, it should not be all that hard for the tormentors, or 
should I say compiler vendors, of the std to support it.

If DWCAS is on an arch then C++ should say it's always lock-free.

Grrrrr!

[toc] | [prev] | [next] | [standalone]


#120835

FromTim Rentsch <tr.17687@z991.linuxsc.com>
Date2024-11-04 06:59 -0800
Message-ID<86cyjbt58d.fsf@linuxsc.com>
In reply to#120754
jseigh <jseigh_es00@xemaps.com> writes:

[...]

> You create a new nullable attribute for pointers.  That
> would make the pointer behave like void* instead of T*.
> You could move, copy, and compare, but you could not
> dereference them.  If you wanted to dereference them
> you would have to apply a special not_null unary predicate
> to them.  What makes it special is the boolean result
> is only valid inside a conditional expression.  It's
> not copyable or referencable.  You could have 1 or
> more of these in a conditional expression along with
> ordinary predicates with the restriction that the
> expression has to be formed such that if any of the
> not_null terms are false, the expression has to
> evaluate as false.
>
> The other thing that makes not_null is that inside
> if the conditional statements true blocks, the
> nullable pointer gets it T* properties back, so
> you can dereference it, but again only in the
> true blocks.  So for example
>
> nullable T* p = &something;
>
> T p2 = *p;	// invalid, compiler thinks you are trying
>                 // do dereference void*
>
> not_null(p);	// invalid, not inside conditional expression
>
> if (not_null(p)
>   p2 = *p;      // valid
> else
>   p2 = *p;      // invalid
>
>
> Traversing a linked list would look like
>
> T* p = head;
> while (not_null(p)) {
>   ...
>   p = p->next;	// valid, inside while true block
> }
>
> not_null would look like
> __predicate_bool not_null(T *&)
> It would make a const copy of T*, test that,
> cast to T*, use it for the true block.
>
> So no NPEs possible for pointer with this
> attribute.

A few comments.

An "attribute" should be placed like a qualifier, next
to the pointer, rather than before the type specifier.

The sense of the attribute should be "never null" rather
than "nullable".  Ordinary pointers are nullable;  what
is needed is a way to indicate that a particular pointer
(either a variable or the return value of a function) will
never be null.

I expect there are implications for pointers to never-null
pointers, but I haven't tried to work out what they need
to be.  Example:  'T *nevernull *p;'.  What are the rules
for assigning to p?

Ordinary pointers can (sometimes) be determined to be
non-null using data flow analysis (like what you say in
the followup post for the linked list example).

There is no need for not_null().  If we see

    if(p){ ... }

or

    while(p){ ... }

we know that p will not be null inside the controlled
statement (subject to change if there is an assignment
to p, per the data flow remark above).

[toc] | [prev] | [next] | [standalone]


#121093

Fromjseigh <jseigh_es00@xemaps.com>
Date2024-11-30 10:03 -0500
Message-ID<vif9fu$1pmuq$1@dont-email.me>
In reply to#120652
On 10/8/24 21:40, Lynn McGuire wrote:
> "Safe C++ is A new Proposal to Make C++ Memory-Safe"
>     https://www.infoq.com/news/2024/10/safe-cpp-proposal/
> 
> "The goal of the Safe C++ proposal is extending C++ by defining a 
> superset of the language that can be used to write code with the strong 
> safety guarantees similarly to code written in Rust. The key to its 
> approach is introducing a new safe context where only a rigorously safe 
> subset of C++ is allowed."
> 
> "The Safe C++ proposal, set forth by Sean Baxter and Christian Mazakas, 
> originates from the growing awareness that C++ memory unsafety lies at 
> the root of a large part of vulnerabilities and memory exploits. The 
> only existing safe language, say Baxter and Mazakas, is Rust, but their 
> design differences limit interoperability, thus making it hard to 
> migrate from one language to the other. For example, Rust lacks function 
> overloading, templates, inheritance, and exceptions, while C++ lacks 
> traits, relocation, and borrow checking."
> 
> Lynn
> 

I did figure out how to do Rust style locking in C++ while working on
some deferred reclamation stuff.  It's fairly simple to implement.
I'm not masochistic enough to want to use it though.

Joe Seigh

[toc] | [prev] | [standalone]


Page 5 of 5 — ← Prev page 1 2 3 4 [5]

Back to top | Article view | comp.lang.c++


csiph-web