public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: J Decker <d3ck0r@gmail.com>
To: gcc@gcc.gnu.org
Subject: Re: C2X Proposal, merge '.' and '->' C operators
Date: Fri, 20 Dec 2019 20:16:00 -0000	[thread overview]
Message-ID: <CAA2GJqWRNKhHOycg5w+U_4E4g8TPYb+uaSwZ1cEL3zYvnZECfQ@mail.gmail.com> (raw)
In-Reply-To: <CAA2GJqUYe3zunsvsQLhvZwAqxCQNxMyX8=aj7rDuKHhCWvWK7A@mail.gmail.com>

On Fri, Dec 20, 2019 at 12:03 PM J Decker <d3ck0r@gmail.com> wrote:

>
>
> On Fri, Dec 20, 2019 at 11:59 AM J Decker <d3ck0r@gmail.com> wrote:
>
>>
>>
>> On Tue, Dec 17, 2019 at 2:53 AM Florian Weimer <fweimer@redhat.com>
>> wrote:
>>
>>> * J. Decker:
>>>
>>> > Here's the gist of what I would propose...
>>> > https://gist.github.com/d3x0r/f496d0032476ed8b6f980f7ed31280da
>>> >
>>> > In C, there are two operators . and -> used to access members of
>>> struct and
>>> > union types. These operators are specified such that they are always
>>> paired
>>> > in usage; for example, if the left hand expression is a pointer to a
>>> struct
>>> > or union, then the operator -> MUST be used. There is no occasion
>>> where .
>>> > and -> may be interchanged, given the existing specification.
>>>
>>> This is incompatible with C++.  I don't think it's worthwhile to change
>>> C in this way.
>>>
>>
>> ya, while I only just saw this, I thought shortly after posting that c++
>> compatibility might be an issue; and they have separate operators overrides
>> for -> and . (which V8 uses such that `Local<Object> lo;`  `lo.IsEmpty();`
>> and `lo->Get()`  are interchangeable.
>>
>> However, if not specifically overridden it could be possible to make a
>> similar change there.   (and conversely not having the operator support the
>> C++ back port wouldn't be an issue).  It's still an error in the native
>> language context to use '.' on a pointer or '->' on a class/struct... and
>> the modification is really a patch to that error to just do the other
>> thing...
>>
> and add -> on references?
>

My first patch was to make the . and -> interchangeable; it could be more
specifically to promote '.' to be either; with the intent to deprecate ->
(in like 2119).
This might simplify the scope of modification to C++; to just augment the
default '.' to behave as -> on a native pointer to a struct/class/union (
I'm not sure how the new safe_ptr templated things end up reacting, I'd
imagine they provide operator overloads, which would take precedence... )


>
>
>>
>>
>>
>>>
>>> Thanks,
>>> Florian
>>>
>>>

  reply	other threads:[~2019-12-20 20:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-16 13:51 J Decker
2019-12-17  4:59 ` J Decker
2019-12-17 10:53 ` Florian Weimer
2019-12-20 19:59   ` J Decker
2019-12-20 20:04     ` J Decker
2019-12-20 20:16       ` J Decker [this message]
2019-12-21 18:27 ` Eric Gallager
2019-12-21 18:51 ` Ian Lance Taylor
2019-12-21 23:04   ` Eric Botcazou
2019-12-21 19:11 ` Allan Sandfeld Jensen
2019-12-27  6:23   ` J Decker
2019-12-27 14:44     ` Tadeus Prastowo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAA2GJqWRNKhHOycg5w+U_4E4g8TPYb+uaSwZ1cEL3zYvnZECfQ@mail.gmail.com \
    --to=d3ck0r@gmail.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).