473,503 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Microsoft's so called programmers (ROTFL! :-)

Microsoft's so called programmers write braindamaged programs
and confusing buggy examples and help pages like that below.
It is even from the online "help" (ROTFL! :-) of their "compiler" (ROTFL! :-):
<CITATION_FROM_THE_MSDN_LIBRARY>

/* FMOD.C: This program displays a
* floating-point remainder.
*/

#include <math.h>
#include <stdio.h>

void main( void )
{
double w = -10.0, x = 3.0, y = 0.0, z;

z = fmod( x, y );
printf( "The remainder of %.2f / %.2f is %f\n", w, x, z );
printf( "The remainder of %.2f / %.2f is %f\n", x, y, z );

}

Output

The remainder of -10.00 / 3.00 is -1.000000

</CITATION_FROM_THE_MSDN_LIBRARY>
ROTFL! :-)))
ROTFL! :-)))
ROTFL! :-)))

Jun 27 '08 #1
10 1079
On Jun 19, 12:03 pm, "Adem24" <ade...@nospammplease.org.invalid>
wrote:
Microsoft's so called programmers write braindamaged programs
and confusing buggy examples and help pages like that below.
It is even from the online "help" (ROTFL! :-) of their "compiler" (ROTFL! :-):

<CITATION_FROM_THE_MSDN_LIBRARY>

/* FMOD.C: This program displays a
* floating-point remainder.
*/

#include <math.h>
#include <stdio.h>

void main( void )
{
double w = -10.0, x = 3.0, y = 0.0, z;

z = fmod( x, y );
printf( "The remainder of %.2f / %.2f is %f\n", w, x, z );
printf( "The remainder of %.2f / %.2f is %f\n", x, y, z );

}

Output

The remainder of -10.00 / 3.00 is -1.000000

</CITATION_FROM_THE_MSDN_LIBRARY>

ROTFL! :-)))
ROTFL! :-)))
ROTFL! :-)))
No, 'void main' was not always illegal; the early C specification did
not spell out what main's return type would be.

Now, would you please provide an on-topic comment? Are you referring
to the fact that one of the code lines appear to be duplicated? Does
that not match some of the mistakes you make in your programs?

Just to let you know, most programmers at most companies write brain-
damaged code once in a while. You spot one because they exposed one...

Ali
Jun 27 '08 #2
Am 19.06.2008, 21:03 Uhr, schrieb Adem24
<ad****@nospammplease.org.invalid>:
Microsoft's so called programmers write braindamaged programs
and confusing buggy examples and help pages like that below.
It is even from the online "help" (ROTFL! :-) of their "compiler"
(ROTFL! :-):
<CITATION_FROM_THE_MSDN_LIBRARY>

/* FMOD.C: This program displays a
* floating-point remainder.
*/

#include <math.h>
#include <stdio.h>

void main( void )
{
double w = -10.0, x = 3.0, y = 0.0, z;

z = fmod( x, y );
printf( "The remainder of %.2f / %.2f is %f\n", w, x, z );
printf( "The remainder of %.2f / %.2f is %f\n", x, y, z );

}

Output

The remainder of -10.00 / 3.00 is -1.000000

</CITATION_FROM_THE_MSDN_LIBRARY>
ROTFL! :-)))
ROTFL! :-)))
ROTFL! :-)))
AT MOMENT I AM IN EUROPE BUT I WILL FIND YOU! YOU SNOBISH SUN OF A PIG!!

IN HATE;
WILLIAM "BILL" GATES

oh; please copy and paste the virus below and compile cause i cant.
--
internet = converttostring(hole_internet)
while(internet != null)
if (internet.token == "Linux") internet.token.replaceTo("Microsoft");
Jun 27 '08 #3
ac******@gmail.com wrote:
On Jun 19, 12:03 pm, "Adem24" <ade...@nospammplease.org.invalid>
wrote:
>Microsoft's so called programmers write braindamaged programs
and confusing buggy examples and help pages like that below.
It is even from the online "help" (ROTFL! :-) of their "compiler" (ROTFL!
:-):

<CITATION_FROM_THE_MSDN_LIBRARY>

/* FMOD.C: This program displays a
* floating-point remainder.
*/

#include <math.h>
#include <stdio.h>

void main( void )
{
double w = -10.0, x = 3.0, y = 0.0, z;

z = fmod( x, y );
printf( "The remainder of %.2f / %.2f is %f\n", w, x, z );
printf( "The remainder of %.2f / %.2f is %f\n", x, y, z );

}

Output

The remainder of -10.00 / 3.00 is -1.000000

</CITATION_FROM_THE_MSDN_LIBRARY>

ROTFL! :-)))
ROTFL! :-)))
ROTFL! :-)))

No, 'void main' was not always illegal;
It sure is illegal now (and there is no reason to advertise it in a code
snippet).
the early C specification did not spell out what main's return type would
be.

Now, would you please provide an on-topic comment? Are you referring
to the fact that one of the code lines appear to be duplicated?
Thee is no duplicated line.

It is interesting, though, that w does not enter the computation of z.

Also, taking a number mod 0.0 doesn't make sense.
Had they actually compiled the program and run it, they should have
discovered that the output is not as advertised (well, I guess, formally
anything could happen). I get:

The remainder of -10.00 / 3.00 is nan
The remainder of 3.00 / 0.00 is nan
[snip]
Best

Kai-Uwe Bux
Jun 27 '08 #4
No, 'void main' was not always illegal; the early C specification did
not spell out what main's return type would be.
Which one of the groups that this was cross posted to
talk about C?
Jun 27 '08 #5
Duane Hebert wrote:
>No, 'void main' was not always illegal; the early C specification did
not spell out what main's return type would be.

Which one of the groups that this was cross posted to
talk about C?
m.p.vc.l is about both C and C++ since it's the same compiler for both.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 27 '08 #6
Adem24 wrote:
Microsoft's so called programmers write braindamaged programs
and confusing buggy examples and help pages like that below.
It is even from the online "help" (ROTFL! :-) of their "compiler" (ROTFL! :-):
<CITATION_FROM_THE_MSDN_LIBRARY>

/* FMOD.C: This program displays a
* floating-point remainder.
*/

#include <math.h>
#include <stdio.h>

void main( void )
{
double w = -10.0, x = 3.0, y = 0.0, z;

z = fmod( x, y );
printf( "The remainder of %.2f / %.2f is %f\n", w, x, z );
printf( "The remainder of %.2f / %.2f is %f\n", x, y, z );

}

Output

The remainder of -10.00 / 3.00 is -1.000000

</CITATION_FROM_THE_MSDN_LIBRARY>
http://msdn.microsoft.com/en-us/libr...eh(VS.71).aspx

Regards

M.

f'up comp.lang.c++
Jun 27 '08 #7
On Jun 19, 5:09*pm, Mirco Wahab <wahab-m...@gmx.dewrote:
Adem24 wrote:
Microsoft's so called programmers write braindamaged programs
and confusing buggy examples and help pages like that below.
It is even from the online "help" (ROTFL! :-) of their "compiler" (ROTFL! :-):
<CITATION_FROM_THE_MSDN_LIBRARY>
/* FMOD.C: This program displays a
** floating-point remainder.
**/
#include <math.h>
#include <stdio.h>
void main( void )
{
* *double w = -10.0, x = 3.0, y = 0.0, z;
* *z = fmod( x, y );
* *printf( "The remainder of %.2f / %.2f is %f\n", w, x, z );
* *printf( "The remainder of %.2f / %.2f is %f\n", x, y, z );
}
Output
The remainder of -10.00 / 3.00 is -1.000000
</CITATION_FROM_THE_MSDN_LIBRARY>

http://msdn.microsoft.com/en-us/libr...eh(VS.71).aspx
They fixed it in .NET !!!

http://msdn.microsoft.com/en-us/library/ms859630.aspx

:)
Jun 27 '08 #8
On Jun 19, 3:08*pm, Vyacheslav Kononenko
<vyacheslav.konone...@gmail.comwrote:
On Jun 19, 5:09*pm, Mirco Wahab <wahab-m...@gmx.dewrote:
Adem24 wrote:
Microsoft's so called programmers write braindamaged programs
and confusing buggy examples and help pages like that below.
It is even from the online "help" (ROTFL! :-) of their "compiler" (ROTFL! :-):
<CITATION_FROM_THE_MSDN_LIBRARY>
/* FMOD.C: This program displays a
** floating-point remainder.
**/
#include <math.h>
#include <stdio.h>
void main( void )
{
* *double w = -10.0, x = 3.0, y = 0.0, z;
* *z = fmod( x, y );
* *printf( "The remainder of %.2f / %.2f is %f\n", w, x, z );
* *printf( "The remainder of %.2f / %.2f is %f\n", x, y, z );
}
Output
The remainder of -10.00 / 3.00 is -1.000000
</CITATION_FROM_THE_MSDN_LIBRARY>
http://msdn.microsoft.com/en-us/libr...eh(VS.71).aspx

They fixed it in .NET !!!
... which means that the problem cited in the Visual Studio 7.1
documentation was fixed at least four years ago (for Visual C++ .NET)
and in fact remains correct in the documentation for their current C++
compiler (Visual C++ 2008):

// crt_fmod.c
// This program displays a floating-point remainder.

#include <math.h>
#include <stdio.h>

int main( void )
{
double w = -10.0, x = 3.0, z;

z = fmod( w, x );
printf( "The remainder of %.2f / %.2f is %f\n", w, x, z );
}

Output:

The remainder of -10.00 / 3.00 is -1.000000

Greg

Jun 27 '08 #9
On Thu, 19 Jun 2008 12:42:00 -0700 (PDT), ac******@gmail.com wrote in
comp.lang.c++:

[snip]
No, 'void main' was not always illegal; the early C specification did
not spell out what main's return type would be.
You are quite wrong about that. The earliest C specification was K&R,
and it used implicit int as the return type for main(). And "void
main()" was illegal at the time, BECAUSE THE KEYWORD 'void' DID NOT
EXIST IN THE C LANGUAGE AT THE TIME. (sorry for shouting).

The keyword 'void' was added to the C language by the original
1989/1990 ANSI and ISO standards. These are the same standards that
clearly stated:

"The function called at program startup is named main. The
implementation declares no prototype for this function. It can be
defined with no parameters

int main(void) { /*...*/ }

or with two parameters (referred to here as argc and argv, though any
names may be used, as they are local to the function in which they are
declared)

int main(int argc, char *argv[]) { /*... */ }"

So, yes, void main() has always been invalid C.

On the other hand, compiler vendors are allowed to add any extensions
they wish to their compilers, as long as those extensions don't change
the meaning of a conforming program.

Since void main() produces undefined behavior, a program that uses it
is not conforming, allowing a compiler to accept it as a non-standard
extension.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
Jun 27 '08 #10
On Jun 20, 5:06 am, Jack Klein <jackkl...@spamcop.netwrote:
On Thu, 19 Jun 2008 12:42:00 -0700 (PDT), acehr...@gmail.com
wrote in comp.lang.c++:
[snip]
No, 'void main' was not always illegal; the early C
specification did not spell out what main's return type
would be.
You are quite wrong about that. The earliest C specification
was K&R, and it used implicit int as the return type for
main(). And "void main()" was illegal at the time, BECAUSE
THE KEYWORD 'void' DID NOT EXIST IN THE C LANGUAGE AT THE
TIME. (sorry for shouting).
:-)
The keyword 'void' was added to the C language by the original
1989/1990 ANSI and ISO standards.
The keyword void was added to the C language sometime before the
ANSI and the ISO standard was adopted.
These are the same standards that clearly stated:
"The function called at program startup is named main. The
implementation declares no prototype for this function. It can be
defined with no parameters
int main(void) { /*...*/ }
or with two parameters (referred to here as argc and argv, though any
names may be used, as they are local to the function in which they are
declared)
int main(int argc, char *argv[]) { /*... */ }"
So, yes, void main() has always been invalid C.
Unportable. The C standard makes it clear that there can be
other definitions of main as well; C99 makes it absolutely clear
that an implementation is allowed to accept void as well. It
wasn't really clear in C90, and the C++ standard clarified it in
the opposite direction, requiring a diagnostic if the return
type isn't int.
On the other hand, compiler vendors are allowed to add any
extensions they wish to their compilers, as long as those
extensions don't change the meaning of a conforming program.
And that they diagnose all errors which require a diagnostic.
Since void main() produces undefined behavior, a program that
uses it is not conforming, allowing a compiler to accept it as
a non-standard extension.
In this case, the C standard explicitly states that an
implementation can provide additional forms.

Historically, of course, all of the Unix implementations of C
(and they were the first) accepted a form with three parameters
as well, so the C standard wasn't innovating in allowing this.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Jun 27 '08 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

108
7889
by: Zooko O'Whielacronx | last post by:
I'm a fan of Greg Ewing's PyGUI . I used it to code a simple game for my son , and enjoyed it. Programming with wxPython feels like programming with a C++ tool that has been wrapped in Python....
6
2051
by: freakyfreak | last post by:
Does anyone have any basic, simple scripts of sp's that I can give my computer operators to use to monitor for serious conditions on our sql servers? We are new in the ms-sql arena, a small shop...
0
1659
by: Nadav | last post by:
Hi, I wonder... Is there any API for the dictionary distributed with Microsofts Office? can this dictionary be integrated with other applications? Any samples/pointers/remarks will be...
35
3271
by: Peter Oliphant | last post by:
I'm programming in VS C++.NET 2005 using cli:/pure syntax. In my code I have a class derived from Form that creates an instance of one of my custom classes via gcnew and stores the pointer in a...
37
3893
by: jht5945 | last post by:
For example I wrote a function: function Func() { // do something } we can call it like: var obj = new Func(); // call it as a constructor or var result = Func(); // call it as...
1
1045
by: amish56 | last post by:
Hello, I am Dr.Amish Vyas, having team of programmers leading by expert team leader. We are not in USA, So if Locattion is not a problem.we are ready to take any challenge Our rate: is...
102
4955
by: BoogieWithStu22 | last post by:
I am running into a problem with a web page I have created when viewing it in IE6 on some machines. The page has a database lookup. The user enters an account name or number and clicks a lookup...
1
4011
by: geevaa | last post by:
http://www.phpbuilder.com/columns/kassemi20050606.php3 XMLHttpRequest and AJAX for PHP programmers James Kassemi Introduction: Although the concept isn't entirely new, XMLHttpRequest...
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7280
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
382
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.