Comment by hoseja Comment by hoseja 3 months ago 6 replies Copy Link View on Hacker News weak typing: 2 + "2" is 22
Copy Link RUnconcerned 3 months ago Collapse Comment - could also be "4" or 4! 4 seems like it would be the most evil option, honestly Reply View | 5 replies Copy Link pjc50 3 months 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 | 3 replies Copy Link sehansen 3 months 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 3 months 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 | 1 reply Copy Link hoseja 3 months ago Root Parent Collapse Comment - The pointer arithmetic works both ways, same as square brackets. Reply View | 0 replies Copy Link baq 3 months 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 3 months 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 | 3 replies Copy Link sehansen 3 months 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 3 months 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 | 1 reply Copy Link hoseja 3 months ago Root Parent Collapse Comment - The pointer arithmetic works both ways, same as square brackets. Reply View | 0 replies
Copy Link sehansen 3 months 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 3 months 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 | 1 reply Copy Link hoseja 3 months ago Root Parent Collapse Comment - The pointer arithmetic works both ways, same as square brackets. Reply View | 0 replies
Copy Link hoseja 3 months ago Root Parent Collapse Comment - The pointer arithmetic works both ways, same as square brackets. Reply View | 0 replies
Copy Link baq 3 months 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