Null this in pgConn::GetStatus

Поиск
Список
Период
Сортировка
От Stuart Gathman
Тема Null this in pgConn::GetStatus
Дата
Msg-id 48a6e0c9-82d8-32e6-d4f9-4b9b87207e66@gathman.org
обсуждение исходный текст
Список pgadmin-hackers
pgadmin3-1.22.1

When compiled with gcc6, the evil practice of "this == 0" fails
horribly.  The most obvious effect is crashing during startup.  I've
attached a simple patch.  The Fedora bugzilla is here:

https://bugzilla.redhat.com/show_bug.cgi?id=1335043

A detailed explanation of why this == 0 is evil:
http://www.viva64.com/en/b/0226/


The patch moves the guts of pgConn::GetStatus() to a static function,
where comparing the ptr arg to 0 is well defined, and makes the
GetStatus() member function call the static function inline.  It is
still technically undefined when calling the GetStatus member function
on a null ptr - but for now the compiler is not eliminating the test.
It is also a step in right direction, which would be to use the static
function at calling sites where the ptr could be null.




Вложения

В списке pgadmin-hackers по дате отправления:

Предыдущее
От: Stuart Gathman
Дата:
Сообщение: Re: Where do I submit patches?
Следующее
От: Stuart Gathman
Дата:
Сообщение: Re: Where do I submit patches?