-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Make C pointers require a keyword. #18352
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
Changes from all commits
d24d38d
461f9c2
bfe26ae
0fde278
b7aa9a2
50d9903
bef6fb0
1b5a2e9
fc88494
af95478
57a9efc
e7aa397
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 |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| thisfileisautotranslatedfromc; | ||
|
Contributor
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. Maybe this has been discussed already, but for the uncommon correct uses of C pointers in std (testing functionality that interacts with them), how about using
Contributor
Author
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. This was discussed, and that was the consensus iirc. |
||
|
|
||
| const std = @import("std.zig"); | ||
| const builtin = @import("builtin"); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| thisfileisautotranslatedfromc; | ||
|
|
||
| const std = @import("../../../std.zig"); | ||
| const kern = @import("kern.zig"); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| thisfileisautotranslatedfromc; | ||
|
|
||
| const std = @import("std"); | ||
|
|
||
| pub inline fn __builtin_bswap16(val: u16) u16 { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| thisfileisautotranslatedfromc; | ||
|
|
||
| test "comptime slice-sentinel in bounds (unterminated)" { | ||
| // array | ||
| comptime { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| export fn a() void { | ||
| const foo: [*c]u8 = undefined; | ||
| _ = foo; | ||
| } | ||
|
|
||
| thisfileisautotranslatedfromc; | ||
|
|
||
| // error | ||
| // backend=stage2 | ||
| // target=native | ||
| // | ||
| // :6:1: error: thisfileisautotranslatedfromc must be the first token in the file |
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.
This file is not auto translated from C.
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.
Yes, I know. Please note that I still need to go through the instances of
thisfileisautotranslatedfromc;that needed to be added, and determine which ones are actually needed. As I said in Ian's review, I will construct them from@Typeif they are truly needed.