Re: remove obsolete NULL casts

Поиск
Список
Период
Сортировка
От Kurt Roeckx
Тема Re: remove obsolete NULL casts
Дата
Msg-id 20040105221850.GA20934@ping.be
обсуждение исходный текст
Ответ на remove obsolete NULL casts  (Neil Conway <neilc@samurai.com>)
Ответы Re: remove obsolete NULL casts  (Neil Conway <neilc@samurai.com>)
Список pgsql-patches
On Mon, Jan 05, 2004 at 04:31:40PM -0500, Neil Conway wrote:
> In any modern dialect of C, casting the "NULL" pointer literal to a
> specific pointer type is unnecessary. For example:
>
>     char *foo;
>     foo = malloc(...);
>     if (foo == (char *) NULL) {...}


In src/backend/port/darwin/system.c you replaced:

execl(_PATH_BSHELL, "sh", "-c", command, (char *) NULL);

By:
execl(_PATH_BSHELL, "sh", "-c", command, NULL);

I think that is one of the exceptions where you do have to cast
it, because the type is unknown.  You can only remove the cast
when you actually know what pointer type it is.


Kurt


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

Предыдущее
От: Neil Conway
Дата:
Сообщение: minor smgr code cleanup
Следующее
От: Tom Lane
Дата:
Сообщение: Re: minor smgr code cleanup