PDA

View Full Version : this takes the cake... microsoft is the saddest company ever!



*ClownPimp*
01-04-2003, 05:53 AM
run this code on Visual Studio 6 in debug mode


#include <iostream>
#include <ctype.h>
int main()
{
if (isalpha(''))
cout << "this is sad" << endl;
else
cout << "okay" << endl;
cin.get();
return 0;
}



Various other characters will also return true. Interestingly, in debug mode, isalpha works correctly....

Fordy
01-04-2003, 06:32 AM
Hmm weird...

I removed the cin.getline() and it worked ok.......

Also, when I jumped to one of the other libraries (multithreaded or multithreaded dll) it worked ok......strange though

Travis Dane
01-04-2003, 11:43 AM
Please don't call Microsoft sad because of 1 mistake in their
compiler, i think MSVC is THE ultimate compiler, every compiler
has its mistakes

Prelude
01-04-2003, 11:49 AM
First, this code will not compile in VC++ 6. Using <iostream> and taking no heed of the std namespace is an error, once that was taken care of the output was "okay".

>every compiler has its mistakes
Yes, but VC++ 6 has more bugs than normal. These were mostly fixed in VC++ .NET though.

-Prelude

RoD
01-04-2003, 11:51 AM
i still say vc++ has the best debugger out, hands down.

Waldo2k2
01-04-2003, 12:40 PM
Originally posted by Ride -or- Die
i still say vc++ has the best debugger out, hands down.

You've never programmed with ADA have you.
Look into it, when you use the GNAT tools and debuggers the debugger actually (nearly) talks to you. It tells you the error, what you probably did wrong, it even checks the spelling (misspelled variables and corrects them), it also makes suggestions as how to fix it. THAT is the best debugger....:)
But for C/C++ I'd agree.

DarkViper
01-04-2003, 01:27 PM
i dont even know how to use any debuggers. for some reason, they just frig up my programming code to make it worse! i set the break points, but thats all i really know how to do, when i press debug, nothing EVER happens. how do i use a debugger to my advantage!?!

*ClownPimp*
01-04-2003, 01:44 PM
>First, this code will not compile in VC++ 6. Using <iostream> and taking no heed of the std namespace is an error,

You sure live up to the subtitle "Nitpicker extraordinaire" :p

Interesting, I just tested that code in a separate project and "this is sad" is the output on mine, even in debug mode. Perhaps you have a service pack installed or something. Also, Im using EE, that might make a difference.

adrianxw
01-04-2003, 02:22 PM
I don't have time to fiddle with this right now, but perhaps the local settings should be considered.

"" is an alpha character in the Danish language, as are , and . Note for the pedants, these are true vowels in our alphabet, they are not "accents". It would irritate me if isalpha('') returned FALSE.

Sang-drax
01-04-2003, 02:41 PM
Hmmm... Isn't '' an alphabetic character?

The function isalpha() returns non-zero if its argument is a letter of the alphabet. Otherwise, zero is returned.

There's also another version of isalpha that takes a character and a const locale&.
I haven't used locales much (read: not at all), but couldn't that be an solution?

*ClownPimp*
01-04-2003, 05:22 PM
Consider this quote from the Visual C++ documentation...



isalpha returns a non-zero value if c is within the ranges A Z or a z.

BMJ
01-04-2003, 06:56 PM
Could be a mistake/overlook in the documentation then perhaps?

Sang-drax
01-05-2003, 04:13 PM
Originally posted by *ClownPimp*
Consider this quote from the Visual C++ documentation...

It doesn't say that it will return 0 for every other case!
There's a difference between "if" and "if and only if"
In fact:

The result of the test condition for the isalpha function depends on the LC_CTYPE category setting of the current locale

*ClownPimp*
01-05-2003, 05:46 PM
Hmmm. I did not notice that :eek: