[
https://issues.apache.org/jira/browse/MESOS-4451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15113765#comment-15113765
]
haosdent commented on MESOS-4451:
---------------------------------
{code}
#include <iostream>
#include <vector>
int main()
{
std::vector<int>* vp = NULL;
if (vp == NULL && vp->size()) {
return 1;
}
return 0;
}
{code}
I use this code snippet to test, when compile with {{-Wnull-dereference}},
{{g++}} show this error.
{code}
g++: error: unrecognized command line option ‘-Wnull-dereference’
$ g++ --version
g++ (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
{code}
When compile with {{clang++}}, it didn't show any warnings.
> Enable `-Wnull-dereference` when building Mesos
> -----------------------------------------------
>
> Key: MESOS-4451
> URL: https://issues.apache.org/jira/browse/MESOS-4451
> Project: Mesos
> Issue Type: Task
> Components: build
> Reporter: Anand Mazumdar
> Priority: Minor
> Labels: mesosphere
>
> Currently we don't have {{-Wnull-dereference}} enabled for Mesos. This can
> sometimes lead to {{NULL}} dereference errors that go unnoticed like the one
> reported in {{MESOS-4449}}.
> We do have {{-Werror}} set to {{-Wall}} but this particular warning is not
> included in {{-Wall}}.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)