Dan Samber <[EMAIL PROTECTED]> wrote:
> Could someone please define the terms "packed" and "unpacked"?

"Unpacked" means a format that can be conveniently and efficiently
manipulated by a program.

Often this involves pointers (which become invalid when your application
exits, so can't be used in long term storage), or wastage of memory.

"Packed" means a memory efficient format that's suitable for long term
storage of lots and lots of records.

Variable length things like strings cause a large part of the
difference.  A packed record format might have the strings packed
closely together:

        <string1 NUL-terminated><string2 NUL-terminated>

while a (bad) corresponding unpacked representation would be

        struct {
          /* Major wastefulness, and arbitrarily restricted length */
          char string1[MAX_STRING_LEN];
          char string2[MAX_STRING_LEN];
          };

or a better unpacked representation would have pointers to separately
allocated strings of appropriate length:

        struct {
          char *string1;
          char *string2;
          };

    John  "and I guess I have no shame for answering :-)"

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to