I just had to leave that in...
Because that is how the C language defines it. See
http://www.eskimo.com/~scs/C-faq/q5.3.html which does not mention the
_Bool type but is talking about boolean expressions and pointers.
Ah. So you are showing me FAQ about something that doesn't actually talk
about the subject at hand, thanks for that. The part of the message the
you conviently snipped to make me look like (more of) an idiot is
reproduced here (the K lines are Keith's and the M are my own):
K> >> I was about to disagree. Fortunately, I looked it up first; you
K> >> can assign a pointer value directly to a _Bool. Interesting.
M> > What does that mean? Assign the pointer to a _Bool or the value
M> > pointed at to a _Bool? The former seems nonsensical,
The rest was snipped, but I think you get my question. I am asking why
people would be recording the TRUE and FALSE values somewhere and using
them somehow (I don't know, saving them to a file or something) - it
didn't make any sense to me.
The standard you linked to just talks about checking whether a pointer
is NULL or not. I was responding to Keith's comment. Again, why would
you assign a pointer address to a _Bool variable, and if you did
wouldn't that result change depending on the hardware / software
platform? You seem to be saying (but don't actually say) that the _Bool
variable will be TRUE for any valid pointer, well no you don't say
valid. You seem to be saying that if the pointer is set to NULL then my
variable, say Bpval, will be false. If my pointer is initialized, then
Bpval will be true. You also say that these values will be consistant
across any Standard C implementation, and it doesn't matter where NULL
is (all zeroes, some special hardware address, a random point in memory,
etc.) AND it doesn't matter if NULL is somewhere other that all-zeros,
but my pointer points to all-zeros.
You don't address the case of a pointer that has not been initialized
yet, and I suppose it might depend on whether it is a global or an
automatic variable. I'm assuming an automatic variable that is a pointer
is init'ed to all-zeros by the compiler, like all the other automatic
variables - what does the Standard say about that?
Side note:
For some reason I seem to prefer "zeroes" with an e when it stands
alone, but "zeros" when it's a compound word like "all-zeros". Hmmm...
new OT topic?...
People assumed, obviously erroneously, that you could do some reasoning
given a hint.
Ah. Yeah. That might be a mistake. I think it is also obvious that
because some people don't like some of my posts they assume I am new at
this. I would find it hard to believe that many experts have dug into
this particular aspect of the C language.
No, I expect you to continue to make stupid posts. On the other hand, I
want you to actually try reading the relevant documentation such as the
comp.lang.c FAQ and a decent text book.
Good assumption. Ah, homework. Doh!
Use Zen to look at the nature of reality, use books on C to look at the
definition of C.
I use various tools at various times for various reasons. I do not
actually have a copy of the Standard, so I rely on the kindness of
strangers in this regard. BTW people, if you are going to tell someone
to read the FAQ, please put a link in your post, every time. Please
don't assume the OP has the link handy on their desktop. I don't me you,
Flash, you did post a link, which I read immediately. Unfortunately, it
was not what we were talking about, but A for effort, esp. since you
think I'm an idiot. Way to go above and beyond.