[go-nuts] Re: Right way to convert c char to golang bytes

2020-06-08 Thread 'Bryan C. Mills' via golang-nuts
Note that in general C strings are not restricted to 2³¹ bytes on 64-bit systems. (Larger strings are unusual, but fairly trivial to construct.) So I would recommend avoiding hard-coded array types of any size. You say that C.GoBytes truncates at zero. However, that does not reproduce for me. Ar

[go-nuts] Re: Right way to convert c char to golang bytes

2020-06-06 Thread Jake Montgomery
Can you post some code that reproduces the C.GoBytes() behavior you see? According to the documentation it should work as you expect. This "simulation" works (but can not be run in the playground because of cgo usage): https://play.golang.org/p/gec7VNy4-UW On Saturday, June 6, 2020 at 2:57:41 AM

[go-nuts] Re: Right way to convert c char to golang bytes

2020-06-06 Thread Tamás Gulácsi
:-) Thanks! -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.go

[go-nuts] Re: Right way to convert c char to golang bytes

2020-06-06 Thread peterGo
Tamás, You have an off-by-one error. For 32-bit ints, maxInt is 1<<31 - 1, not 1<<31. For GOARCH=386, constant 2147483648 overflows int array bound is too large Peter On Saturday, June 6, 2020 at 3:35:27 AM UTC-4, Tamás Gulácsi wrote: > > Use 1<<31 instead of 1024. > And ifthe C side won't mo