C++ Logo


Advanced search

Re: RFC: disjoint qualifier

From: Thiago Macieira <thiago_at_[hidden]>
Date: Wed, 23 Sep 2020 21:19:38 -0700
On Thursday, 17 September 2020 18:37:32 PDT Eric Lengyel via Std-Proposals
> http://terathon.com/disjoint_lengyel.pdf
> Please discuss.

Can pointers to disjoint be copied?

  void func(disjoint int *p1, disjoint int *p2, int c);
  void func(disjoint int *p1, disjoint int *p2)
  { func(p1, p2, 42); }

If the answer yes, how about:

  void func2(disjoint int *p1, disjoint int *p2)
      disjoint int *p3 = p1;
      disjoint int *p4 = p2;
      func(p3, p4, 42);

And if this is allowed, what's stopping me from instead writing:

  void func2(disjoint int *p1, disjoint int *p2)
      disjoint int *p3 = p1;
      func(p1, p3, 42);


In "Disjoint from birth" you allow the qualifier to be applied to concrete

  void Multiply(const Matrix *m1, const Matrix *m2, disjoint Matrix *result);
  disjoint Matrix product;
  Multiply(&a, &b, &product);

But earlier in "inverse qualifier, you allow dropping the keyword:

  disjoint int *d;
  int *s = d; // OK: disjoint qualifier can be removed

That means I can write:
  disjoint Matrix product;
  disjoint Matrix *p = &product;
  Matrix *m = p;
  Multiply(m, m, p);

Which overload gets called?
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DPG Cloud Engineering

Received on 2020-09-23 23:19:47