Nothing. Not zero (though zero may be used to represent it), but nothingness. The /dev/null device is a throw-away bit bucket used when you don't want to see the output: often a cron entry would be something like "/usr/bin/someprog > /dev/null 2>&1"
C language strings are null (zero) terminated, and functions may return NULL pointers if they were supposed to return a pointer to something real. Don't confuse this with the very common convention in the shell and elsewhere of returning 0 for success.
The fact that null is often the same as zero is a source of problems. For example, is a reference to "0" a reference to null or a legitimate attempt to access the very first byte of memory? See section 1.3 and 1.4 of https://www.lysator.liu.se/c/c-faq/c-1.html. A Google search for "NULL Pointer" will lead to all sorts of problems, confusion and errors.
Got something to add? Send me email.
More Articles by Tony Lawrence © 2011-07-05 Tony Lawrence
In C++ it's harder to shoot yourself in the foot, but when you do, you blow off your whole leg. (Bjarne Stroustrup)
"The /dev/null device is a throw-away bit bucket used when you don't want to see the output..."
/dev/null can also be used as a source of input when you want to test EOF logic in a program. A read from /dev/null will always return EOF. Beats waiting until you get to the other end of a big file.
--BigDumbDinosaur
Printer Friendly Version
null Copyright © October 2003 Tony Lawrence
Have you tried Searching this site?
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.
Contact us
Printer Friendly Version