zed icon indicating copy to clipboard operation
zed copied to clipboard

Compilation error on 32 bit platforms in zed/runtime/expr

Open clausecker opened this issue 3 years ago • 2 comments

This line of code in zed/runtime/expr/sort.go

if max := math.MaxUint32; n > max {

fails to compile in 32 bit mode as such:

runtime/expr/sort.go:27:12: cannot use math.MaxUint32 (untyped int constant 4294967295) as int value in assignment (overflows)

To fix the code, you can e.g. add a cast like this:

if max := math.MaxUint32; int64(n) > max {

clausecker avatar Aug 01 '22 04:08 clausecker

I'll plan to add some text in the CONTRIBUTING doc to set expectations that 32-bit is not currently supported and point to this issue if users want to vote to boost the priority. If I can figure out how to rig up the Makefile to prevent compilation on 32-bit architectures I'll do that as well.

philrz avatar Sep 21 '22 22:09 philrz

Sounds good! I'm just a porter/packager. Please do what is most appropriate for your projects needs.

clausecker avatar Sep 21 '22 23:09 clausecker

In #4433 text was added to the CONTRIBUTING doc to emphasize that compilation on 32-bit is not currently supported. The same PR also changed the Makefile to detect if this is attempted and exit with an error message.

This issue will remain open to gather interest in adding 32-bit support. Users that find their way here should add a comment describing their use case. Thanks!

philrz avatar Mar 27 '23 20:03 philrz