V doctor:
OS: linux, Ubuntu 20.04.1 LTS (WSL 2)
Processor: 12 cpus, 64bit, little endian, Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
CC version: cc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
getwd: /home/gladear/workspace
vmodules: /home/gladear/.vmodules
vroot: /home/gladear/workspace/v
vexe: /home/gladear/workspace/v/v
vexe mtime: 2020-12-13 17:28:35
is vroot writable: true
is vmodules writable: true
V full version: V 0.1.30 5fec0d7.ecfd124
Git version: git version 2.25.1
Git vroot status: weekly.2020.48.2-271-gecfd1243
.git/config present: true
thirdparty/tcc status: thirdparty-linux-amd64 7543de81
What did you do?
outer_bound := u32(2)
for i := 0; i < outer_bound; i++ {
println(i)
}
for i := u32(0); i < outer_bound; i++ {
println(i)
}
What did you expect to see?
~/workspace 禄 v run bug.v
0
1
0
1
What did you see instead?
~/workspace 禄 v run bug.v
0
1
2
0
1
I'm not seeing it... you got the output you expected, so where's the problem?
Erf, copy paste mistake, I'll edit it 馃檭
So, after some research, the code to "blame" for that is the following (both are directly related):
https://github.com/vlang/v/blob/master/vlib/v/gen/cheaders.v#L291,302
https://github.com/vlang/v/blob/master/vlib/v/gen/cgen.v#L3015
But it looks completely correct to me 馃槙 I'm looking a bit further into the details of this issue.
Edit: Actually, no, currently the way its done is the same as saying a < b <=> b >= a which is indeed incorrect.
Most helpful comment
Erf, copy paste mistake, I'll edit it 馃檭