| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | free() |
> RM> Nothing actually wrong with returning ptr after it's been freed, > RM> it's just pointless. Unless it's used to return an error if > RM> something in the function failed (a bit obfuscated for my taste, > RM> unless fully commented...) > As i've said in an earlier mssg, it did return the correct string > properly, even after it was freed Don't rely on DOS's braindeadedness (ah! a new word!) too much. If I did the same under OS/2 or Win32, and dereferenced that freed pointer, I'd get a nice segmentation violation and the program would halt. OS/2 is a great environment for debugging things like this. :-) > at one stage i executed a few more > functions just to see, how long it'll take until it gets corrupted, got > tired of waiting, the string was still in there. You probably did not allocate any more memory, so the freed block never got stomped on. Or if you did, it was larger, and/or was allocated out of a different area of the heap. In any case, it doesn't matter. > Of course it's not advisable, and it was basically just a test. Which only goes to prove that real-mode DOS is real-mode DOS. It demonstrates nothing at all about C. Regards, David --- MaltEd/2 1.0.b6* Origin: Unique Computing Pty Limited (3:632/348) SEEN-BY: 50/99 620/243 623/630 632/103 107 348 360 633/371 634/388 396 SEEN-BY: 635/301 502 503 506 544 639/252 711/401 409 410 413 430 808 809 932 SEEN-BY: 711/934 712/515 713/888 714/906 800/1 @PATH: 632/348 635/503 50/99 711/808 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.