| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Pointers |
From: Roger Scudder
RS> That is actually covered by the standard in section 7.20.3.2
RS> regarding free:
RS> "If ptr is a NULL pointer, no action occurs."
I still test it, just to see if it is necessary to perform the
call at all. I like to keep a firm grip on my pointers so I don't
accidentally poke my eye out while attempting to shoot myself in
the foot. I want them to be 0 when not in use, and not to be used
when they are 0.
RS> BTW, I didn't edit the test function in my reply to Bo, though
RS> it definitely needs a test condition after the call to
RS> malloc. I was only focusing on the question, which was "how
RS> do I free the memory?"... though in hindsight I probably
RS> should have added testing to the entire snippet for the sake
RS> of consistency.
I put the test conditions in because, as Bob noted earlier,
when you start out in DOS, you distrust anything untested. I like
to build and test any code I produce as an example, just to make
sure I remember syntax and my C basics. I haven't been doing
enough coding to keep the rust off, unfortunately. So, when I do
the testing for compilability, I make sure I'm not playing
pointer roulette at the same time. Personal paranoia. :)
> kkuzba{at}centurytel.net http://home.centurytel.net/kkuzba
> 'D`you mean to say you've been through this hole?' said Sam.
--- SoupGate-Win32 v1.05
* Origin: kkuzba{at}centurytel.net (2:292/516.666)SEEN-BY: 633/267 270 @PATH: 292/516 854 140/1 106/2000 633/267 |
|
| 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™.