C++ Logo

std-proposals

Advanced search

Proposal - Allow '.' operator to work on pointers (again sortof)

From: J Decker <d3ck0r_at_[hidden]>
Date: Wed, 4 Mar 2020 16:44:28 -0800
Reformatted this to resemble standard proposal

https://gist.github.com/d3x0r/f496d0032476ed8b6f980f7ed31280da
It fails to be ' The proposal may be in PDF, HTML, or plain text formats. '

TL;DR

C Standard section 6.5.2.3 Structure and union members

add text in [ ]

1- The first operand of the . operator shall have a qualified or
unqualified structure or union type or [‘‘pointer to qualified or
unqualified structure’’ or ‘‘pointer to qualified or unqualified union’’,]
and the second operand shall name a member of that type.

C++ Standard section 8.5.1.5 Class member access

add: if the first expression of (dot) is a pointer [to an object], then
E1.E2 is converted to (*(E1)).E2 .

J

Received on 2020-03-04 18:47:25