Re: SYSTEM(3)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Jonny Grant <jg@xxxxxxxx>, 2018-11-11, 14:26:
BTW, C Spec says NULL is a pointer that doesn't have a type,

Not quite. NULL is a “null pointer constant”, which could be an integer, not necessarily a pointer.

That said, the POSIX.1-2008 standard guarantees it's a pointer. (AFAICT, the earlier standards did not guarantee this.)

On the other hand, NULL is not defined as a pointer in C++.

there is no need to cast it to (char *)   -- should that be taken out?

The execl*() functions are variadic, which makes them picky about argument types. Theses casts are certainly needed when NULL is not defined as a pointer.

It's less clear to me if they are still necessary when NULL is defined as (void*)0.

Either way, I recommend keeping the cast for the sake of portability.

--
Jakub Wilk



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux