Never has been a problem. We tend to use tools at their most critical setting; and most of the C compilers we used regularly accurately emitted warnings on anything that could be unintentional, such as missing equal signs and empty loop blocks.
I'm not sure what you mean by "missing equal signs". In vs2008 with warnings and errors set to the strictest settings this compiles just fine:
int n = 1;
if( n = 2)
cout << "now it's two" << endl;
As far as I can remember I have never used a compiler that produce a warning or error on that because in C/C++ it's perfectly valid to evaluate an assignment result as an expression to be non-zero. So if you typo
n == 2 into n = 2 you get no warnings or errors but you don't get the intended behavior. However if you do:
2 == n and typo it to 2 = n you get a compiler error. It's your choice and since I don't have to maintain your code I don't really care what you choose.
Most of my work is done outside the PC and Microsoft arena; I am not very familiar with Visual Studio C++ compilers, if they don't warn you on if( n = 2) then that is too bad; a decent compiler knows such statement is valid, hence no error, but probably wrong, hence a warning, which can be disabled as all messages normally have a numeric code, or avoided by writing unambiguous code as in if((n = 2)!=0)...
That is what warnings are all about: pointing your attention at things that might be intentional and correct, and maybe are not.
BTW: most compilers also would warn you the condition is always true, making the if , and when present the else part, redundant.
Luc Pattyn [Forum Guidelines][My Articles] DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
i some code as bellow. it is mothed is called when click on MenuItem.problem is when i click item and command = "LOGOFF", it work correctly, but why i click a MenuItem and its command = "EXIT" , the visual studio doesn't stop debuging even my form was disappear?
void MenuItemCommand(ExtenderMenu btn )
switch (btn.Command )
Form2 f = null;
if ( f == null || f.IsDisposed)
f = new Form2();
You're getting a lot of help here, which is great. But, what you should learn from this is that you need to do some basic study, to understand these VERY basic things. I sure hope no-one is actually going to use this code, the only place you should be in, is a class. And, you should talk to your teacher first, as he can help you better if he knows how stuck you are, and doesn't read other people's code and assume you wrote it.
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
i've created Windows services connecting to web services. but i wz just wondering...
i hv a web service i want utilised by a mobile application. is there anyway i can achieve this? Or rather, is there anything like an equivalent of a windows service on mobile devices?
pls help ASAP.
He who goes for revenge must first dig two graves.