Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Const pointer for HexapodDamage #20

Open
dogoepp opened this issue Jul 7, 2016 · 2 comments
Open

Const pointer for HexapodDamage #20

dogoepp opened this issue Jul 7, 2016 · 2 comments

Comments

@dogoepp
Copy link
Member

dogoepp commented Jul 7, 2016

Very little importance detail here. Since we use a pointer for extra damage information, would it make sense to use a pointer to const, or even a const pointer to const ?

The code concerned is in hexapod_dart -> hexapod.hpp:

struct HexapodDamage {
        HexapodDamage() {}
        HexapodDamage(const std::string& type, const std::string& data, void* extra = nullptr) : type(type), data(data), extra(extra) {}

        std::string type;
        std::string data;
        void* extra = nullptr;
};
@jbmouret
Copy link
Member

jbmouret commented Jul 7, 2016

It would make sense to not use a void*...

-- JBM

On Thu, Jul 7, 2016 at 10:01 AM Dorian Goepp notifications@github.com
wrote:

Very little importance detail here. Since we use a pointer for extra
damage information, would it make sense to use a pointer to const, or even
a const pointer to const ?

The code concerned is in hexapod_dart -> hexapod.hpp
https://github.com/resibots/hexapod_simu/blob/master/hexapod_dart/include/hexapod_dart/hexapod.hpp
:

struct HexapodDamage {
HexapodDamage() {}
HexapodDamage(const std::string& type, const std::string& data, void* extra = nullptr) : type(type), data(data), extra(extra) {}

    std::string type;
    std::string data;
    void* extra = nullptr;

};


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#20, or mute the thread
https://github.com/notifications/unsubscribe/AFu8v84ckYyr2xUK0__mcl7LZvjWyng7ks5qTK_sgaJpZM4JG0tf
.

@costashatz
Copy link
Member

It would make sense to not use a void*

But I want it to be able to add anything of any type.. I could make it a string and then parse it..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants