ISSUE 636

Number 636
Category errata
Synopsis 4.2.3.2 et al: null character is "NUL", not "NULL"
State lrmdraft
Class errata-simple
Arrival-DateNov 24 2004
Originator Shalom Bresticker <Shalom.Bresticker@freescale.com>
Release 2001b
Description
Steven Dovich said in http://www.eda.org/sv-cc/hm/2205.html:

"To be properly consistent with the C language, we also need to
recognize that NULL is not a character, it is a pointer. C strings
are composed of characters and are terminated by a "null character".
Common usage also designates the character valued as '\0' as the
NUL character from the ASCII character names (note the three letter
spelling). "

and 2207.html:

"Yes, though as I noted, NUL as a character name is not acknowledged
in the C standard. It is a (somewhat) common usage from the ASCII
standard and is replaced in the C standard with "null character".

When spelled in lower case, the word "null" is ambiguous and must
be qualified by "character", "pointer", etc. The upper case NULL
is the standardized spelling for a "null pointer", a constant
expression evaluating to zero that is used as a pointer.

/sjd

> So NULL is a pointer and NUL is a character?"

and Brad Pierce in http://www.eda.org/sv-ec/hm/2220.html:

"In ANSI C, NULL is a macro that the C preprocessor converts into
a null pointer constant. A null pointer constant is an integer
constant expression with the value 0 or the cast of such an expression
to void*.

However, it is NOT a null pointer. It is compiled into a null pointer.
And the bit representation of a null pointer need NOT be zeros. Null
pointers are implementation-dependent and may be different for different
types, for example, pointers to data objects vs. pointers to functions.
All that's required is that any two null pointers are ==, that casting
a null pointer of one type to another pointer type results in a null
pointer, and that null pointers can't be confused for an actual pointer
to some object or function."

What is relevant to this errata submission is that when referring to null
characters,
it should refer to NUL instead of NULL.

Places I found where this apparently should be changed are:

4.2.3.2: "The comparison and concatenation operators shall not distinguish
between zeros resulting from padding and the original string characters (\0,
ASCII NULL)."

4.2.3.3: The null string ("") shall be considered equivalent to the ASCII NULL
("\0") which has a value zero (0), which is different from a string "0".

In 27.15, I am confused by the use of both the terms "character array" and
"array of pointers to characters":

"The format of the argv array is that each pointer in the array shall point to
a NULL terminated character array which contains the string located on the
tool's invocation command line. There shall be `argc' entries in the argv array.
The value in entry zero shall be the tool's name.
The vendor tool may provide a command line option to pass a file containing a
set of options. In that case, the argument strings returned by
vpi_get_vlog_info() shall contain the vendor option string name followed by a
pointer to a NULL terminated array of pointers to characters. This new array
shall contain the parsed contents of the file. The value in entry zero shall
contain the name of the file. The remaining entries shall contain pointers to
NULL terminated character arrays containing the different options in the file.
The last entry in this array shall be NULL. If one of the options is the vendor
file option, then the next pointer shall behave the same as described above. "

--
Shalom Bresticker Shalom.Bresticker @freescale.com
Design & Verification Methodology Tel: +972 9 9522268
Freescale Semiconductor Israel, Ltd. Fax: +972 9 9522890
POB 2208, Herzlia 46120, ISRAEL Cell: +972 50 5441478

[ ]Freescale Internal Use Only [ ]Freescale Confidential Proprietary



Fix
CHANGE "NULL" to "NUL" in

4.2.3.2: "The comparison and concatenation operators shall not distinguish
between zeros resulting from padding and the original string characters (\0,
ASCII NULL)."


4.2.3.3: The null string ("") shall be considered equivalent to the ASCII NULL
("\0") which has a value zero (0), which is different from a string "0".


27.15: "The format of the argv array is that each pointer in
the array shall point to a NULL terminated character array
which contains the string located on the tool's invocation command line."

27.15: "The remaining entries shall contain pointers to
NULL terminated character arrays containing the different options in the file."

Audit-Trail
From: Steven Sharp <sharp@cadence.com>
To: etf-bugs@boyd.com, Shalom.Bresticker@freescale.com
Cc:
Subject: Re: errata/636: 4.2.3.2 et al: null character is "NUL", not "NULL"
Date: Wed, 24 Nov 2004 13:25:53 -0500 (EST)

>In 27.15, I am confused by the use of both the terms "character array" and
>"array of pointers to characters":

I think it involves both. There is an array of pointers, with the last
pointer in the array being a NULL pointer, as a terminator. Each of those
pointers points to an array of characters, with the last character in each
being a NUL character, as a terminator. This allows for an arbitrary number
of command line arguments, each of which is an arbitrary length string.

Steven Sharp
sharp@cadence.com


Fix replaced by Shalom.Bresticker@freescale.com on Thu Nov 25 00:08:03 2004

CHANGE "NULL" to "NUL" in

4.2.3.2: "The comparison and concatenation operators shall not distinguish
between zeros resulting from padding and the original string characters (\0,
ASCII NULL)."


4.2.3.3: The null string ("") shall be considered equivalent to the ASCII NULL
("\0") which has a value zero (0), which is different from a string "0".


27.15: "The remaining entries shall contain pointers to
NULL terminated character arrays containing the different options in the file."




Fix replaced by Shalom.Bresticker@freescale.com on Mon Nov 29 09:46:00 2004
CHANGE "NULL" to "NUL" in

4.2.3.2: "The comparison and concatenation operators shall not distinguish
between zeros resulting from padding and the original string characters (\0,
ASCII NULL)."


4.2.3.3: The null string ("") shall be considered equivalent to the ASCII NULL
("\0") which has a value zero (0), which is different from a string "0".


27.15: "The format of the argv array is that each pointer in
the array shall point to a NULL terminated character array
which contains the string located on the tool's invocation command line."

27.15: "The remaining entries shall contain pointers to
NULL terminated character arrays containing the different options in the file."



Unformatted


Hosted by Boyd Technology