| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Pointers |
Hello Bob! Replying to a message of Bob Stout to Jerry Coffin: BS> Arguably even better are... BS> assert(x = malloc(somesize)); Ewwwww! No way. Asserts are supposed to take care of things that can't (by definition) happen, not things that can happen (like being out of memory). And, thus, when you have your system ready for production, just add -DNDEBUG to your compilation units, and the tests go away ... and so does your memory allocation ;-) BS> ...or... BS> #define MALLOC(ptr,size) if(NULL==(ptr=malloc(size))) abort() This is completely different - you're actually handling the out-of-memory condition explicitly ... not gracefully, but explicitly ;-) BS> MALLOC(x, somesize); Darin ---* Origin: Tanktalus' Tower BBS (1:250/102) SEEN-BY: 633/267 270 @PATH: 250/102 99 10/345 106/1 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™.