Skip to content

Commit 048ebda

Browse files
committed
resolve c++ compilation issue
Synchronize with obieq/sds#1 Pending in antirez/sds#125
1 parent a3257ff commit 048ebda

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

sds.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ struct __attribute__ ((__packed__)) sdshdr64 {
8080
#define SDS_TYPE_64 4
8181
#define SDS_TYPE_MASK 7
8282
#define SDS_TYPE_BITS 3
83+
#ifdef __cplusplus
84+
#define SDS_HDR_VAR(T,s) struct sdshdr##T *sh = (struct sdshdr##T*)((s)-(sizeof(struct sdshdr##T)));
85+
#else
8386
#define SDS_HDR_VAR(T,s) struct sdshdr##T *sh = (void*)((s)-(sizeof(struct sdshdr##T)));
87+
#endif
8488
#define SDS_HDR(T,s) ((struct sdshdr##T *)((s)-(sizeof(struct sdshdr##T))))
8589
#define SDS_TYPE_5_LEN(f) ((f)>>SDS_TYPE_BITS)
8690

0 commit comments

Comments
 (0)