Closed mewmew closed 4 years ago
After applying PR #850, the Go output looks as follows:
/*
Package main - transpiled by c2go version: v0.25.9 Dubnium 2018-12-30
If you have found any issues, please raise an issue at:
https://github.com/elliotchance/c2go/
*/
package main
type T int32
const (
FOO T = 0
BAR = 1
)
type T int32
// f - transpiled function from /home/u/Desktop/ccc/m/m.c:6
func f(t int32) (c2goDefaultReturn int32) {
switch t {
case FOO:
{
return int32(42)
}
case BAR:
{
return int32(10)
}
default:
{
return int32(0)
}
}
return
}
func init() {
}
When transpiling C source code using enum literals in expressions,
nil
values are used for their corresponding Go expressions.Example input C source code
Example output Go source code
Notice the
case nil:
lines of functionf
.C AST