Files
carbon-lang/docs/design/expressions/pointer_operators.md
T
Chandler CarruthandRichard Smith 94d2c1c6d4 Make proposal filenames use 6 digits and include the title (#7245)
We've talked about adding the title to the filename several times over
the years and it seems really valuable. This requires us to compute a
"slug" for the title spelling that can be part of the filename.

Beyond that, we crossed 7000 recently, and so it seems likely that we
will need to add digits sooner rather than later here, so this goes
ahead and moves us to 6 digits so we don't have to adjust again for a
reasonable length of time.

To implement this and ensure we can sustain it going forward this adds a
tool to our pre-commit that validates (and corrects if needed) the
filename.

In order to update everything and keep links working, there are a _lot_
of changes, but the most interesting for direct review are in
`proposals/scripts`.

Assisted-by: Antigravity with Gemini

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2026-05-29 00:55:04 +00:00

1.8 KiB

Pointer operators

Table of contents

Overview

Carbon provides the following operators related to pointers:

  • & as a prefix unary operator takes the address of an object, forming a pointer to it.
  • * as a prefix unary operator dereferences a pointer.

Note that member access expressions include an -> form that implicitly performs a dereference in the same way as the * operator.

Details

The semantic details of pointer operators are collected in the main pointers design. The syntax and precedence details are covered here.

The syntax tries to remain as similar as possible to C++ pointer types as they are commonly written in code and are expected to be extremely common and a key anchor of syntactic similarity between the languages.

Precedence

These operators have high precedence. Only member access expressions can be used as an unparenthesized operand to them.

The two prefix operators & and * are generally above the other unary and binary operators and can appear inside them as unparenthesized operands. For the full details, see the precedence graph.

Alternatives considered

References