← Back to context Comment by hoseja 17 days ago weak typing: 2 + "2" is 22 6 comments hoseja Reply RUnconcerned 17 days ago could also be "4" or 4! 4 seems like it would be the most evil option, honestly pjc50 17 days ago The real evil option is C: 2+"22" = 0, 4+"4" = undefined behavior and probably the value of some other variable. sehansen 17 days ago The real horror is "1d9" + 1 = 2, as does PHP: https://3v4l.org/Dn6Sm manwe150 17 days ago I think you meant: "22"+2 = "", and it is not UB to make the second pointer, only to use it 1 reply → baq 17 days ago or the most sane, depending on context... e.g. awk and perl do this.
RUnconcerned 17 days ago could also be "4" or 4! 4 seems like it would be the most evil option, honestly pjc50 17 days ago The real evil option is C: 2+"22" = 0, 4+"4" = undefined behavior and probably the value of some other variable. sehansen 17 days ago The real horror is "1d9" + 1 = 2, as does PHP: https://3v4l.org/Dn6Sm manwe150 17 days ago I think you meant: "22"+2 = "", and it is not UB to make the second pointer, only to use it 1 reply → baq 17 days ago or the most sane, depending on context... e.g. awk and perl do this.
pjc50 17 days ago The real evil option is C: 2+"22" = 0, 4+"4" = undefined behavior and probably the value of some other variable. sehansen 17 days ago The real horror is "1d9" + 1 = 2, as does PHP: https://3v4l.org/Dn6Sm manwe150 17 days ago I think you meant: "22"+2 = "", and it is not UB to make the second pointer, only to use it 1 reply →
manwe150 17 days ago I think you meant: "22"+2 = "", and it is not UB to make the second pointer, only to use it 1 reply →
could also be "4" or 4! 4 seems like it would be the most evil option, honestly
The real evil option is C: 2+"22" = 0, 4+"4" = undefined behavior and probably the value of some other variable.
The real horror is "1d9" + 1 = 2, as does PHP: https://3v4l.org/Dn6Sm
I think you meant: "22"+2 = "", and it is not UB to make the second pointer, only to use it
1 reply →
or the most sane, depending on context... e.g. awk and perl do this.