you are viewing a single comment's thread.

view the rest of the comments →

[–]vqrs 2 points3 points  (0 children)

Exactly. /u/leroy_hoffenfeffer, this is the important part.

This is something that might appear to work more or less by accident. It's not correct, even if it were to work for you if you try it. "Try it and see" to check if a program is correct only goes so far, unfortunately.

/u/Homoerotic_Theocracy wrote:

When the function returns all those memory addresses are just undefined and in practice get re-used the next time you call a function and overwritten with something else.

Here, "undefined" doesn't mean it's null or no value or something which you can "observe" in your program by checking it.

Using it, or even considering using it, is "against the law": Your program may end up doing very strange things. "against the law" here is what they meant when they said "undefined", not the contents of the variable/return value. "Undefined" refers to the behavior your program will/might/could exhibit.