cplusplus / cplusplus/draft

[dcl.fct] It is unclear whether zero-size arrays in function parameters are allowed CWG 3121

Open
#6,575 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cwg not-editorial
Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Description

[dcl.fct] p5 does not sufficiently clarify the following case:

void foo(int[0]);

The type of int[0] would be adjusted to int*, but since int[0] was never a valid type in the first place, there is nothing to be adjusted.

I believe that the existing wording in [dcl.array] is sufficiently clear for this to be an editorial issue. int[0] is not a valid type, so an adjustment of it cannot retroactively make it valid.

We could add the following line to the example in the mentioned paragraph:

void j(int[0]); // ill-formed

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review [dcl.fct] p5 alongside the existing wording in [dcl.array], focusing on the void foo(int[0]); case and the surrounding example. Clarify in the draft that the zero-size array parameter is ill-formed, then verify that the example and wording consistently communicate this.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.