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

A

Adem24

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! :)))
 
A

acehreli

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
 
B

Bill Gates

Am 19.06.2008, 21:03 Uhr, schrieb Adem24
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.
 
K

Kai-Uwe Bux

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
 
D

Duane Hebert

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

Mirco Wahab

Adem24 said:
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/library/20dckbeh(VS.71).aspx

Regards

M.

f'up comp.lang.c++
 
G

Greg Herlihy


They fixed it in .NET !!![/QUOTE]

... 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
 
J

James Kanze

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,172
Messages
2,570,934
Members
47,475
Latest member
ShannonGro

Latest Threads

Top