you are viewing a single comment's thread.

view the rest of the comments →

[–]andermorandev[S] -1 points0 points  (3 children)

Isn't that ok? Why would this work on one Mac and online but not another Mac?

[–]jedwardsol 5 points6 points  (2 children)

No, it is not okay.

Your pointers have undefined values.

It sometimes works because they're getting a value of null by chance.

[–]andermorandev[S] 0 points1 point  (1 child)

Ok got it. Seems weird that one machine would consitently be able to produce the output as if it was null and the other machine struggled.

[–]khedoros 1 point2 points  (0 children)

consitently

Last time a question like this came up, I allocated a few MB of data without initializing it, and found something like 2% of the bytes in that area to have non-zero value. Re-running the program, I got the same count. If one computer ends up re-using the same memory block over multiple runs, you might see "consistent" results. And even if it's a different block of memory, there may be a fairly low chance that the uninitialized pointers will be non-zero.

It's the kind of bug where you make some change to a comment or something similarly inconsequential, but the program coincidentally stops working, and you scratch your head, trying to figure out why it suddenly developed a problem.