-
Notifications
You must be signed in to change notification settings - Fork 261
use a repeat expression for arrays with a single initializer #1218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,16 @@ void entry(const unsigned buffer_size, int buffer[const]) | |
struct {char* x; int y;} arr3[1] = {}; | ||
arr3[0].y += 9; | ||
|
||
int arr4[16] = {0}; | ||
arr4[15] += 9; | ||
|
||
struct {short; int y;} arr5[1] = { { 1, 2 } }; | ||
arr5[0].y += 9; | ||
|
||
// excess elements | ||
int arr6[2] = { 1, 2, 3 }; | ||
int arr7[0] = { 1234 }; | ||
Comment on lines
+17
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What actually runs the logic in |
||
|
||
int i = 0; | ||
|
||
char abc[] = "abc"; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We specifically want zero initialization, not necessarily default initialization, although they are usually the same, and seems to be for all cases in
fn implicit_default_expr
. It seems like it doesn't handlestruct
s/union
s/enum
s, though, whichfn zero_initializer
does, so we probably want to use both and clarify the naming/docs to ensure it's specifically zero.