C coding tip: Self-manage data buffer memory

The C programming language defines two standard memory management functions: malloc() and free(). C programmers frequently use those functions to allocate buffers at run time to pass data between functions. In many situations, however, you cannot predetermine the actual sizes required for the buffers, which may cause several fundamental problems for constructing complex C programs. This article advocates a self-managing, abstract data buffer. It outlines a pseudo-C implementation of the abstract buffer and details the advantages of adopting this mechanism.

25 Comments

  1. 2004-01-07 5:55 pm
  2. 2004-01-07 6:01 pm
  3. 2004-01-07 7:11 pm
  4. 2004-01-07 7:35 pm
  5. 2004-01-07 7:39 pm
  6. 2004-01-07 7:39 pm
  7. 2004-01-07 7:55 pm
  8. 2004-01-07 7:56 pm
  9. 2004-01-07 8:12 pm
  10. 2004-01-07 8:30 pm
  11. 2004-01-07 9:06 pm
  12. 2004-01-07 9:53 pm
  13. 2004-01-07 10:22 pm
  14. 2004-01-07 10:58 pm
  15. 2004-01-07 11:46 pm
  16. 2004-01-08 12:15 am
  17. 2004-01-08 1:55 am
  18. 2004-01-08 2:42 am
  19. 2004-01-08 2:48 am
  20. 2004-01-08 4:06 am
  21. 2004-01-08 4:44 am
  22. 2004-01-08 12:26 pm
  23. 2004-01-08 3:17 pm
  24. 2004-01-08 4:00 pm
  25. 2004-01-08 6:04 pm