News for hackers. Stuff that matters.
Re:Interviewing programmers: coding test example explained by nevinera on Thursday June 03, 2010 @11:37AM (#1401592)
>it is a bit weird to say they are null-terminated

Yeah, it would be. They're NUL-terminated.

Re:Interviewing programmers: coding test example explained by Xurinos on Thursday June 03, 2010 @11:49AM (#1401627)
Unfortunately, "null-terminated", although incorrect, is widely used. :(

http://googlefight.com/index.php?lang=en_GB&word1=%22nul...

I hate all the variations of nothing. undef, null, NULL, NIL, NUL...

Re:Interviewing programmers: coding test example explained by tedunangst on Thursday June 03, 2010 @11:57AM (#1401662)
How can "null-terminated" be incorrect when that is the language used by the C standard?
Re:Interviewing programmers: coding test example explained by Xurinos on Thursday June 03, 2010 @12:10PM (#1401697)
I stand corrected. I looked at my old ASCII tables. This is a silly semantic argument.

http://www.asciitable.com/

The character shorthand is "NUL", but the full name is "null". I still stand by my (silly semantic) point that the use of NULL is overloaded here. NULL is a pointer value, not a character value. The string does not terminate at a pointer; it terminates with a magic character. This has, in fact, bitten me in the past where '\0' was a legitimate member of my string, and I have to write my own accessors.

Re:Interviewing programmers: coding test example explained by nuxi on Thursday June 03, 2010 @05:10PM (#1402573)
I'm not convinced that NUL vs. C's "null character" is just a silly semantic argument. NUL is an ASCII abbreviation and the implementors probably wanted to avoid being tied to a particular character encoding - there is no mention of NUL in the C standard.

As for the NULL, it needn't be a pointer value, the standard permits it being "an integral constant expression with the value 0", so in certain implementations it can be the same as '\0'.

Re:Interviewing programmers: coding test example explained by nevinera on Thursday June 03, 2010 @01:13PM (#1401864)
if '\0' was a legitimate member, it was not a string, it was a character/byte array, probably of fixed size.