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

GCC Compiler Warnings #3

Open
Sapd opened this issue May 19, 2013 · 1 comment
Open

GCC Compiler Warnings #3

Sapd opened this issue May 19, 2013 · 1 comment

Comments

@Sapd
Copy link
Collaborator

Sapd commented May 19, 2013

Hi,
cool & useful Code,
but some Compile Warnings on GCC via Linux with parameter -WALL

../MCQuery.cpp: In member function ‘void mcQuery::challengeReceiver(const boost::system::error_code&, size_t)’:
../MCQuery.cpp:96:68: warning: missing braces around initializer for ‘std::array<unsigned char, 5ul>::value_type [5] {aka unsigned char [5]}’ [-Wmissing-braces]
../MCQuery.cpp: In member function ‘void mcQuery::dataReceiver(const boost::system::error_code&, size_t)’:
../MCQuery.cpp:128:68: warning: missing braces around initializer for ‘std::array<unsigned char, 5ul>::value_type [5] {aka unsigned char [5]}’ [-Wmissing-braces]
../MCQuery.cpp: In member function ‘void mcQuerySimple::receiver(const boost::system::error_code&, size_t)’:
../MCQuery.cpp:291:44: warning: missing braces around initializer for ‘std::array<unsigned char, 2ul>::value_type [2] {aka unsigned char [2]}’ [-Wmissing-braces]
../MCQuery.cpp:296:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

There are just some braces missing, so here are the lines & the code which are fixed:
Line 96:

const array<uchar,5> expected = {{ 0x09, 0x01, 0x02, 0x03, 0x04 }};
Line 128:
const array<uchar,5> expected = {{ 0x00, 0x01, 0x02, 0x03, 0x04 }};
Line 291:
array<uchar,2> expected = {{ 0xFF, 0x00 }};

Also on Line 296, the compiler doesn't like the comparison between unsigned and signed. So:

for( unsigned int i=0; i<recvBuffer.size()/2; i++) {

Best regards, Sapd

@Erikvv
Copy link
Owner

Erikvv commented May 19, 2013

I think it would look better, without the = sign. Double braces are mandatory according to the standard, but this will probably change in the future.

const array expected {{ 0x09, 0x01, 0x02, 0x03, 0x04 }};

I'm currently writing a branch to make this a header-only library, plus add support for concurrent queries. I'll incorporate those changes there.

@Erikvv Erikvv closed this as completed May 19, 2013
@Erikvv Erikvv reopened this May 19, 2013
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

2 participants