Comments (6)
With clang C++, fixing this issue is now a one-line change: simply replace the void*
in the definition of SDS_HDR_VAR
with struct sdshdr##T *
.
from sds.
I've uploaded patches for that, cf. #31
from sds.
Uh, oh, I'm not so experienced with github. The two patches I suggest are commits
bf77d21f39e6fec3feda9cf08ce29232c4eb3d77
43e7040e7ad962f481047b4ed94402c2d798a4f6
in the lemzwerg/sds
clone.
from sds.
I think you are right, but there are far more issues with C++ – the concept of 'flexible array members' doesn't exist at all in the C++ standard! See the many other sds pull requests I've merged into my sds tree (lemberg/sds
); some of them are written by me, which I've also submitted to antirez. However, antirez hasn't used any of the suggested pull requests (many of them quite important IMHO). Right now, I'm too lazy to update the various pull requests to SDS 2.
from sds.
I'm having this issue as well, you can't include and use sds
with C++ projects.
sds/sds.h:115:13: error: cannot initialize a variable of type 'struct sdshdr8 *' with an rvalue of type 'void *'
SDS_HDR_VAR(8,s);
^~~~~~~~~~~~~~~~
sds/sds.h:87:44: note: expanded from macro 'SDS_HDR_VAR'
#define SDS_HDR_VAR(T,s) struct sdshdr##T *sh = (void*)((s)-(sizeof(struct sdshdr##T)));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sds/sds.h:119:13: error: cannot initialize a variable of type 'struct sdshdr16 *' with an rvalue of type 'void *'
SDS_HDR_VAR(16,s);
^~~~~~~~~~~~~~~~~
sds/sds.h:87:44: note: expanded from macro 'SDS_HDR_VAR'
#define SDS_HDR_VAR(T,s) struct sdshdr##T *sh = (void*)((s)-(sizeof(struct sdshdr##T)));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sds/sds.h:123:13: error: cannot initialize a variable of type 'struct sdshdr32 *' with an rvalue of type 'void *'
SDS_HDR_VAR(32,s);
^~~~~~~~~~~~~~~~~
sds/sds.h:87:44: note: expanded from macro 'SDS_HDR_VAR'
#define SDS_HDR_VAR(T,s) struct sdshdr##T *sh = (void*)((s)-(sizeof(struct sdshdr##T)));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sds/sds.h:127:13: error: cannot initialize a variable of type 'struct sdshdr64 *' with an rvalue of type 'void *'
SDS_HDR_VAR(64,s);
^~~~~~~~~~~~~~~~~
sds/sds.h:87:44: note: expanded from macro 'SDS_HDR_VAR'
#define SDS_HDR_VAR(T,s) struct sdshdr##T *sh = (void*)((s)-(sizeof(struct sdshdr##T)));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 errors generated.
from sds.
The odd thing is, it looks like this is updated in Hiredis
. @antirez could you please update your library? This repository should represent the latest changes to these files.
https://github.com/redis/hiredis/blob/master/sds.h
from sds.
Related Issues (20)
- Dead Store v.2.0.0
- Error in example HOT 1
- Use of _ in string causes sdssplitlen() to return no tokens HOT 1
- sds and interrupts
- Some confusions on sdshdr5 & sdshdr8 on key/value actual memory usage and MEMORY USAGE command HOT 1
- malloc/realloc only powers of two? HOT 1
- sdscat & sdscatsds in-place? HOT 1
- Question: Violation of Strict Aliasing Rule ? HOT 3
- sdscatfmt doesn't support flags
- How can i clear the string without freeing it?
- Maintenance? HOT 3
- Unexpected behaviour HOT 1
- Generate libsds.so HOT 2
- Potential integer overflow in sds.c
- Potential undefined behavior when negating value in sdsll2str
- README mistake: sdstrim does not return void
- SDS version 2 compilation error with visual c++ compiler. HOT 3
- Make install target HOT 1
- Using sds in embedded environment, even on Arduino? HOT 2
- Null Dereferences v2.0.0 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sds.