-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow creating uninitialized C structs
This adds support for creating uninitialized C structures by leaving out _all_ the field assignments when creating an instance. This makes dealing with large structs that are initialized by a separate function less painful, as one doesn't have to explicitly assign all fields to some value (along with the necessary type casts). Changelog: added
- Loading branch information
1 parent
73f31dc
commit df3b4fa
Showing
6 changed files
with
65 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class extern Foo { | ||
let @a: Int32 | ||
let @b: Int32 | ||
let @c: Int32 | ||
} | ||
|
||
fn example1 { | ||
let foo = Foo() | ||
} | ||
|
||
fn example2 { | ||
let foo = Foo(a: 0 as Int32, b: 1 as Int32, c: 2 as Int32) | ||
} | ||
|
||
fn example3 { | ||
let foo = Foo(a: 0 as Int32, b: 1 as Int32) | ||
} | ||
|
||
# class_extern_without_fields.inko:16:13 error(missing-field): the field 'c' must be assigned a value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters