a question about sdshdr5

22 views
Skip to first unread message

sky xiong

unread,
Dec 17, 2018, 2:51:30 AM12/17/18
to Redis DB
Hi,
when I read sds.h,I find the note indicate that "sdshdr5 is never used, we just access the flags byte directly.However is here to document the layout of type 5 SDS strings.".
but when I set a short string, like ">set test hello", I find  the key "test" is actuall stroed by sdshdr5 by gdb.it seems  that sdshdr5  is used.
what does that  notes mean?
Here is the source code :

/* Note: sdshdr5 is never used, we just access the flags byte directly.
 * However is here to document the layout of type 5 SDS strings. */

struct __attribute__ ((__packed__)) sdshdr5 {
   
unsigned char flags; /* 3 lsb of type, and 5 msb of string length */
   
char buf[];
};



Reply all
Reply to author
Forward
0 new messages