Git Product home page Git Product logo

Comments (6)

prideout avatar prideout commented on September 24, 2024 3

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.

lemzwerg avatar lemzwerg commented on September 24, 2024

I've uploaded patches for that, cf. #31

from sds.

lemzwerg avatar lemzwerg commented on September 24, 2024

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.

lemzwerg avatar lemzwerg commented on September 24, 2024

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.

kellabyte avatar kellabyte commented on September 24, 2024

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.

kellabyte avatar kellabyte commented on September 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.