From 048ebda4563af7c57a5802e13f29177f5ff90782 Mon Sep 17 00:00:00 2001 From: Blazczak Date: Mon, 24 Nov 2025 03:09:34 -0800 Subject: [PATCH] resolve c++ compilation issue Synchronize with obieq/sds#1 Pending in antirez/sds#125 --- sds.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sds.h b/sds.h index adcc12c..af847d1 100644 --- a/sds.h +++ b/sds.h @@ -80,7 +80,11 @@ struct __attribute__ ((__packed__)) sdshdr64 { #define SDS_TYPE_64 4 #define SDS_TYPE_MASK 7 #define SDS_TYPE_BITS 3 +#ifdef __cplusplus +#define SDS_HDR_VAR(T,s) struct sdshdr##T *sh = (struct sdshdr##T*)((s)-(sizeof(struct sdshdr##T))); +#else #define SDS_HDR_VAR(T,s) struct sdshdr##T *sh = (void*)((s)-(sizeof(struct sdshdr##T))); +#endif #define SDS_HDR(T,s) ((struct sdshdr##T *)((s)-(sizeof(struct sdshdr##T)))) #define SDS_TYPE_5_LEN(f) ((f)>>SDS_TYPE_BITS)