git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] imap-send: cleanup execl() call to use NULL sentinel instead of 0

From
MRMarco Roeland <marco.roeland@xs4all.nl>
Date
Mar 11, 2006, 20:30 UTC
Message-ID
<20060311203022.GA1578@fiberbit.xs4all.nl>
In-Reply-To
<118833cc0603110601x6ac9b2b6kaa0277981c6dd44b@mail.gmail.com>
On Saturday March 11th 2006 Morten Welinder wrote:
Show 5 quoted lines
> If you're going to fix that, you should use (char *)NULL or
> (char *)0, just in case you end up on a machine where
> NULL doesn't a pointer type.
> 
> (Yup, NULL can be a null pointer without having pointer type.)

For gcc NULL is specifically always guaranteed to be a valid sentinel. And it was basically just about fixing the gcc warning, no pedantics intended! All other uses within git for the exec() family also use plain uncast NULL, which looks better anyway.

Strictly speaking you're probably right, but there's a chance that this will generate warnings on other compilers.

And if you should use a compiler with a weird notion of NULL, you're probably better off switching compilers immediately. ;-)

-- 
Marco Roeland
Previous: Morten Welinder
Message 3 of 3 in “imap-send: cleanup execl() call to use NULL sentinel instead of 0”
  1. imap-send: cleanup execl() call to use NULL sentinel instead of 0Marco Roeland, Mar 11, 2006
  2. Morten WelinderMar 11, 2006
  3. Marco RoelandMar 11, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.