Can't print char!

M

Mark McIntyre

On the off chance
that this is not a rhetorical question, I think it highly unlikely that they
would change the spelling of NUL though.

They won't and they haven't. Its still spelled NUL.
 
R

Richard Bos

osmium said:
I really dislike threads such as this, on the various meanings of nul, null,
NUL and NULL. But your reference is specious, the *official;* ASCII chart
lists the character with a value of binary zero as NUL. Not NULL, as your
link above says.

The above is from a Unicode document. The NULL is not the ASCII three-
letter name, but the full Unicode name. The next line is

0x01 0x0001 # START OF HEADING

If it'd been ASCII, that would have said SOH, not START OF HEADING. In
fact, from the header of that document:

# Column #3 the Unicode name (follows a comment sign, '#')

Richard
 
P

pete

osmium said:
the *official;* ASCII chart
lists the character with a value of binary zero as NUL.

That would matter if C was even constrained by ASCII.

Maybe there are some other non C documents
which have amusing definitions of NULL.

When using terms defined by the C standard,
in a discussion about C in the C newsgroup,
it seems obvious to me that the definition in the standard
is the one to use.
 
W

Walter Roberson

:Maybe there are some other non C documents
:which have amusing definitions of NULL.

:When using terms defined by the C standard,
:in a discussion about C in the C newsgroup,
:it seems obvious to me that the definition in the standard
:is the one to use.

Ah, well, the C89 standard makes no reference to NUL, but
does refer to the character with all 0 bits as "the null character".
The macro NULL expands to an implimentation defined
"null pointer constant".

So... any reference to "the null character" or "the NULL character" is
consistant with the C89 standard, but "the NUL character" is an
ANSI/ASCII/Unicode construct that lies outside the standard.
Certainly, though, if one just writes NULL with a qualifying
"character" or "pointer constant" then it would be best resolved in
favour of the "pointer constant" interpretation.
 
K

Keith Thompson

pete said:
When using terms defined by the C standard,
in a discussion about C in the C newsgroup,
it seems obvious to me that the definition in the standard
is the one to use.

It's often adequate to make it clear that the term is being used in a
sense other than the one defined by the C standard. For example, we
can certainly discuss the fact that "byte" usually means 8 bits out in
the non-C world, while making it clear that C's use of the term is
tied to CHAR_BIT. (There was a recent brouhaha in comp.std.c over the
term "strictly conforming", which apparently is used by both the C and
POSIX standards; if it had been made clear that the term was being
used in the POSIX sense, a long boring thread could have been
avoided.)
 
K

Keith Thompson

:Maybe there are some other non C documents
:which have amusing definitions of NULL.

:When using terms defined by the C standard,
:in a discussion about C in the C newsgroup,
:it seems obvious to me that the definition in the standard
:is the one to use.

Ah, well, the C89 standard makes no reference to NUL, but
does refer to the character with all 0 bits as "the null character".
The macro NULL expands to an implimentation defined
"null pointer constant".

So... any reference to "the null character" or "the NULL character" is
consistant with the C89 standard, but "the NUL character" is an
ANSI/ASCII/Unicode construct that lies outside the standard.
Certainly, though, if one just writes NULL with a qualifying
"character" or "pointer constant" then it would be best resolved in
favour of the "pointer constant" interpretation.

If the C89 standard refers to "the null character", why on Earth would
you talk about "the NULL character"? If you're going to shout, go
ahead and shout: "THE NULL CHARACTER!!!".
 
O

osmium

pete said:
When using terms defined by the C standard,
in a discussion about C in the C newsgroup,
it seems obvious to me that the definition in the standard
is the one to use.

Which is precisely what started this thread!!

Someone used NULL when talking about a _character_. Roberson objected to
that usage since NULL has already been defined by the standard to mean
something else. The best standards use a word to mean one, and only one,
unambiguous thing.
 
W

Walter Roberson

:Which is precisely what started this thread!!

:Someone used NULL when talking about a _character_. Roberson objected to
:that usage since NULL has already been defined by the standard to mean
:something else.

That's a rather ahistorical interpretation of the thread.

I (presumably the person you refer to as 'Roberson') used the phrase
"NULL character". Ken suggested that the name of the character is
NUL, not NULL, and that NULL should not be used because it refers
to the NULL pointer constant. I pointed out that Unicode refers to
the character as NULL. More recently, I pointed out [in response to
a message of yours, if I recall correctly] that the C standard
never refers to NUL, but does refer to "null character" and
"null pointer constant", and defines a macro named NULL to expand
to a null pointer constant.

Along the way there were digressions into what various X3.4 versions
might have used, seeing as the official names of several ANSI characters
have changed since the time the standard was first worked on in 1965.
Unfortunately, there is a shortage of copies of X3.4-1968 to check
the typography in.

:The best standards use a word to mean one, and only one,
:unambiguous thing.

Hmmm, let's see...

-(p-- - q) - -3.141e-5 - 2.71728 - '-'

That's - for unary minus, for auto-decrement, for arithmetic
subtraction between floating point numbers, for pointer subtraction,
for arithmetic subtraction between integers and floats, and for
indicating a negative constant, for indicating a negative exponent
in that constant, for indicating a particular character constant, and
for arithmetic between a floats and characters. Good thing we have
Language Designer and Technical Writer Osmium to tell us how put
it all together in such a way that words mean one, and only one,
unambiguous thing.
 
K

Keith Thompson

:Which is precisely what started this thread!!

:Someone used NULL when talking about a _character_. Roberson objected to
:that usage since NULL has already been defined by the standard to mean
:something else.

That's a rather ahistorical interpretation of the thread.

I (presumably the person you refer to as 'Roberson') used the phrase
"NULL character". Ken suggested that the name of the character is
s/Ken/Keith/

NUL, not NULL, and that NULL should not be used because it refers
to the NULL pointer constant. I pointed out that Unicode refers to
the character as NULL. More recently, I pointed out [in response to
a message of yours, if I recall correctly] that the C standard
never refers to NUL, but does refer to "null character" and
"null pointer constant", and defines a macro named NULL to expand
to a null pointer constant.

Along the way there were digressions into
[snip]
 
D

Dik T. Winter

> osmium wrote:
>
>
> That would matter if C was even constrained by ASCII.
>
> Maybe there are some other non C documents
> which have amusing definitions of NULL.

There is a difference between NUL and NULL.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,161
Messages
2,570,891
Members
47,423
Latest member
henerygril

Latest Threads

Top