Предупреждает ли хотя бы один флаг g++ о разыменовании нулевого указателя?C++

Программы на C++. Форум разработчиков
Гость
Предупреждает ли хотя бы один флаг g++ о разыменовании нулевого указателя?

Сообщение Гость »


I wanted to check whether a g++ compiler-flag exists that warns me about nullpointer-dereferencing. When compiling this code with

Код: Выделить всё

g++ (GCC) 13.1.1
and these compiler flags: -Wnull-dereference, -Wnonnull, still nothing happens. No warning, no error..

Код: Выделить всё

#include  int main() {   double *elem = new (std::nothrow) double;   elem = nullptr;   std::cout 

Источник: [url]https://stackoverflow.com/questions/76359001/does-even-a-single-g-flag-warn-about-nullpointer-dereferencing[/url]

Вернуться в «C++»