-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Simplify
Box<T>
to *T
for C only.
- Loading branch information
Showing
8 changed files
with
146 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include <stdarg.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
typedef struct NotReprC_Box_i32 NotReprC_Box_i32; | ||
|
||
typedef NotReprC_Box_i32 Foo; | ||
|
||
typedef struct MyStruct { | ||
int32_t *number; | ||
} MyStruct; | ||
|
||
void delete(int32_t *x); | ||
|
||
void root(const Foo *a, const MyStruct *with_box); |
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,24 @@ | ||
#include <stdarg.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
typedef struct NotReprC_Box_i32 NotReprC_Box_i32; | ||
|
||
typedef NotReprC_Box_i32 Foo; | ||
|
||
typedef struct MyStruct { | ||
int32_t *number; | ||
} MyStruct; | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif // __cplusplus | ||
|
||
void delete(int32_t *x); | ||
|
||
void root(const Foo *a, const MyStruct *with_box); | ||
|
||
#ifdef __cplusplus | ||
} // extern "C" | ||
#endif // __cplusplus |
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,16 @@ | ||
#include <stdarg.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
typedef struct NotReprC_Box_i32 NotReprC_Box_i32; | ||
|
||
typedef NotReprC_Box_i32 Foo; | ||
|
||
typedef struct { | ||
int32_t *number; | ||
} MyStruct; | ||
|
||
void delete(int32_t *x); | ||
|
||
void root(const Foo *a, const MyStruct *with_box); |
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,24 @@ | ||
#include <stdarg.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
typedef struct NotReprC_Box_i32 NotReprC_Box_i32; | ||
|
||
typedef NotReprC_Box_i32 Foo; | ||
|
||
typedef struct { | ||
int32_t *number; | ||
} MyStruct; | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif // __cplusplus | ||
|
||
void delete(int32_t *x); | ||
|
||
void root(const Foo *a, const MyStruct *with_box); | ||
|
||
#ifdef __cplusplus | ||
} // extern "C" | ||
#endif // __cplusplus |
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,16 @@ | ||
#include <stdarg.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
struct NotReprC_Box_i32; | ||
|
||
typedef struct NotReprC_Box_i32 Foo; | ||
|
||
struct MyStruct { | ||
int32_t *number; | ||
}; | ||
|
||
void delete(int32_t *x); | ||
|
||
void root(const Foo *a, const struct MyStruct *with_box); |
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,24 @@ | ||
#include <stdarg.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
struct NotReprC_Box_i32; | ||
|
||
typedef struct NotReprC_Box_i32 Foo; | ||
|
||
struct MyStruct { | ||
int32_t *number; | ||
}; | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif // __cplusplus | ||
|
||
void delete(int32_t *x); | ||
|
||
void root(const Foo *a, const struct MyStruct *with_box); | ||
|
||
#ifdef __cplusplus | ||
} // extern "C" | ||
#endif // __cplusplus |
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,16 @@ | ||
#[repr(C)] | ||
pub struct MyStruct { | ||
number: Box<i32>, | ||
} | ||
|
||
pub struct NotReprC<T> { | ||
inner: T, | ||
} | ||
|
||
pub type Foo = NotReprC<Box<i32>>; | ||
|
||
#[no_mangle] | ||
pub extern "C" fn root(a: &Foo, with_box: &MyStruct) {} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn delete(x: Box<i32>) {} |