no :: in func decls
This commit is contained in:
@@ -14,7 +14,7 @@ types. C primitives use atomic target-dependent names and remain semantically
|
||||
distinct from exact-width Brolang primitives:
|
||||
|
||||
```bro
|
||||
strlen :: c_func(value *c_char) c_ulong
|
||||
strlen c_func(value *c_char) c_ulong
|
||||
```
|
||||
|
||||
Additional native inputs and libraries are passed to the final `zig cc`
|
||||
@@ -35,7 +35,7 @@ Relative `.h` imports create synthetic package namespaces backed by libclang:
|
||||
```bro
|
||||
native :: import "../include/native.h"
|
||||
|
||||
main :: func() void {
|
||||
main func() void {
|
||||
_ = native.imported_add(20, 22)
|
||||
}
|
||||
```
|
||||
@@ -63,11 +63,11 @@ from Brolang requires an explicit unwrap:
|
||||
```bro
|
||||
native :: import "../include/native.h"
|
||||
|
||||
double :: c_func(value c_int) c_int {
|
||||
double c_func(value c_int) c_int {
|
||||
return value + value
|
||||
}
|
||||
|
||||
call_mapper :: func(mapper native.Imported_Mapper) c_int {
|
||||
call_mapper func(mapper native.Imported_Mapper) c_int {
|
||||
return mapper?(21)
|
||||
}
|
||||
```
|
||||
@@ -75,16 +75,16 @@ call_mapper :: func(mapper native.Imported_Mapper) c_int {
|
||||
Bodyless manual and imported C functions may be variadic:
|
||||
|
||||
```bro
|
||||
log_values :: c_func(tag c_int, ...) c_int
|
||||
log_values c_func(tag c_int, ...) c_int
|
||||
```
|
||||
|
||||
Zero-terminated byte strings can be passed directly to immutable C character
|
||||
pointers without making `u8` and `c_char` generally interchangeable:
|
||||
|
||||
```bro
|
||||
printf :: c_func(format *c_char, ...) c_int
|
||||
printf c_func(format *c_char, ...) c_int
|
||||
|
||||
main :: func() void {
|
||||
main func() void {
|
||||
_ = printf("answer: %d\n", 42)
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user