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

src/AMQPMessage.cpp #72

Open
chifho opened this issue Nov 20, 2017 · 8 comments
Open

src/AMQPMessage.cpp #72

chifho opened this issue Nov 20, 2017 · 8 comments

Comments

@chifho
Copy link

chifho commented Nov 20, 2017

There is an error during compilation of the file at line 48. The signature of the function is:
char * AMQPMessage::getMessage(uint32_t* length)

On line 48, the return statement is:
return '\0'

which is a char. And it does not agree with the return type.

I would like to suggest to change it to:
return NULL;
or
return (char *) '\0';

@TomeC
Copy link
Collaborator

TomeC commented Nov 21, 2017

你用的什么编译器
What compiler do you use?
my compiler version
gcc 版本 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)

@TomeC
Copy link
Collaborator

TomeC commented Nov 21, 2017

NULL == '\0' == 0

@chifho
Copy link
Author

chifho commented Nov 21, 2017 via email

@chifho
Copy link
Author

chifho commented Nov 21, 2017 via email

@TomeC
Copy link
Collaborator

TomeC commented Nov 22, 2017

Different compiler restrictions are not the same.
You can modify the code to adapt to different compilers.
By the way, where are you from?

@chifho
Copy link
Author

chifho commented Nov 22, 2017

Yes, I could modify the code to make it work. However, since I am pulling the git directly from within the Docker Container and do the build within, it would be nice that the fix can be done at the source instead of having a custom script to modify the source.

@zhanb
Copy link

zhanb commented Sep 6, 2018

你这代码不严谨啊,不能怪人家编译器,一个是char,一个是char*

@ChrisPappalardo
Copy link

There is an error during compilation of the file at line 48. The signature of the function is:
char * AMQPMessage::getMessage(uint32_t* length)

On line 48, the return statement is:
return '\0'

which is a char. And it does not agree with the return type.

I would like to suggest to change it to:
return NULL;
or
return (char *) '\0';

I have this same issue on Ubuntu 18.04.2 LTS using g++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0 and the following change to line 48 resolved the compilation error:

return (char *) '\0';

Thanks

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

4 participants