mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-11 06:23:39 +00:00
cgo: implement prefix parsing
This implements expressions such as "-5" and "-5 - 2", in other words, negative numbers.
This commit is contained in:
committed by
Ron Evans
parent
70f8eeaca0
commit
711889bc3f
Vendored
+2
@@ -6,6 +6,7 @@ int fortytwo(void);
|
||||
int mul(int, int);
|
||||
#include <string.h>
|
||||
#cgo CFLAGS: -DSOME_CONSTANT=17
|
||||
#define someDefine -5 + 2 * 7
|
||||
*/
|
||||
import "C"
|
||||
|
||||
@@ -26,6 +27,7 @@ func main() {
|
||||
println("defined floats:", C.CONST_FLOAT, C.CONST_FLOAT2)
|
||||
println("defined string:", C.CONST_STRING)
|
||||
println("defined char:", C.CONST_CHAR)
|
||||
println("defined expr:", C.someDefine)
|
||||
var ptr C.intPointer
|
||||
var n C.int = 15
|
||||
ptr = C.intPointer(&n)
|
||||
|
||||
Reference in New Issue
Block a user