Laaca Czech republic, 27.03.2021, 20:06 |
Not widely known problem in programming? (Developers) |
I would like to share my experience with source of several my very mysterious programming bugs. In several cases I for many hours tried to debug some part of my program and was not able to find the bug. Sometimes I've given to up and sometimes I've avoided the problem with some ugly hack but never really found what was wrong. --- |
ecm Düsseldorf, Germany, 27.03.2021, 20:30 @ Laaca |
Not widely known problem in programming? |
I'd call this a type of "use after free". --- |
tkchia 28.03.2021, 08:02 @ ecm |
Not widely known problem in programming? |
Hello ecm, hello Laaca, --- |
marcov 28.03.2021, 17:44 @ tkchia |
Not widely known problem in programming? |
> > I'd call this a type of "use after free". |
bretjohn Rio Rancho, NM, 29.03.2021, 20:03 @ tkchia |
Not widely known problem in programming? |
> > I'd call this a type of "use after free". |
Laaca Czech republic, 29.03.2021, 22:24 @ bretjohn |
Not widely known problem in programming? |
> You simply cannot reference a local variable from a different local procedure and expect it to be reliable (sometimes it will --- |
bretjohn Rio Rancho, NM, 29.03.2021, 23:02 @ Laaca |
Not widely known problem in programming? |
I don't think a compiler is going to help much in this case. You've set up "message" as a global variable, but then equate it to a variable inside a local procedure called "s" so "s" and "message" are really the same thing. When "s" disappears, so does "message". So, while "message" appears to be global it really isn't. I'm not sure any kind of debugger/troubleshooter can catch things when you have pointers and redirection like that. |
marcov 30.03.2021, 12:05 @ bretjohn |
Not widely known problem in programming? |
> I don't think a compiler is going to help much in this case. |
ecm Düsseldorf, Germany, 29.03.2021, 22:26 @ bretjohn |
Not widely known problem in programming? |
> They are both correct. You simply cannot reference a local variable from a --- |
ecm Düsseldorf, Germany, 28.03.2021, 21:52 @ Laaca |
Not widely known problem in programming? |
> --- |
Laaca Czech republic, 29.03.2021, 05:04 @ ecm |
Not widely known problem in programming? |
> I was curious about the meaning of your example. The FreePascal --- |