elliotchance / c2go

⚖️ A tool for transpiling C to Go.
MIT License
2.06k stars 151 forks source link

group of constants #513

Open Konstantin8105 opened 6 years ago

Konstantin8105 commented 6 years ago

Present Go result:

const _CS_POSIX_V7_LP64_OFF64_LINTFLAGS int = 1143
const _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS int = 1144
const _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS int = 1145
const _CS_POSIX_V7_LPBIG_OFFBIG_LIBS int = 1146

Better:

const (
_CS_POSIX_V7_LP64_OFF64_LINTFLAGS int  = 1143
_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS       = 1144
_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS      = 1145
_CS_POSIX_V7_LPBIG_OFFBIG_LIBS         = 1146
)
elliotchance commented 6 years ago

I agree with this, but how will we decide how they should be grouped. We don't want all constants for the same type to simply be grouped. Maybe we could find all constants that have the same prefix and group them together?