siska said:
Wow I had no idea so many people cared.
The code was just a snippet - so:
1. I did not imply what type "wait_for_somthing" was.
2. What the type or value of "true" was.
[big snip]
***QUOTE***
? Where is the identifier "true" defined? If you're using C99, it's
in <stdbool.h>; if you're using C++, it's keyword, but C++ is
off-topic here in comp.lang.c. (I just noticed that this is
cross-posted to comp.lang.c and comp.lang.c++; that's hardly ever a
good idea.)
***QUOTE***
Who the hell said anything about c++? If I was talking c++ I would
have posted in the c++ forum! Just because I used "true" doesnt' meen
I am talking c++, what if that of "true" is defined as 26?
It would be polite to indicate who you're quoting.
You *did post to the c++ forum (perhaps not intentionally). Take a
look at the Newsgroups header; this thread is cross-posted to
comp.lang.c and comp.lang.c++. Assuming that you might be using C++
(note that I wrote "*if* you're using C++) isn't much of a stretch.
Even if you had posted only to comp.lang.c, it still wouldn't have
been much of a stretch; many people (inappropriately) post C++ code to
comp.lang.c.
And if you're using C, defining the identifier "true" yourself is
still a bad idea, since C99's <stdbool.h> header defines "true" as a
macro, which expands to the integer constant 1. It won't cause any
real problems if you use a C90 implementation, or if you don't use
"#include <stdbool.h>", but it's still best to avoid it. If you want
to define your own Boolean type in C90, you can do something like
this:
typedef enum { FALSE, TRUE } BOOL;
or this:
typedef int BOOL;
#define FALSE 0
#define FALSE 1
See also section 9 of the comp.lang.c FAQ.
(C++, building on the experience of C, avoided this problem by
defining bool, false, and true as keywords from the very beginning.
Unfortunately, making such a change in C would have broken existing
code.)
You posted code (possibly pseudo-code) that included the line
if( wait_for_something == true )
I pointed out that that's a bad idea, and explained why. I don't know
why you seem to have a problem with that; somebody else might learn
from it, even if you don't.
If you post code here, people will comment on it. If don't want
people commenting on your code, don't post it.