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