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

Discussion in 'C++' started by Adem24, Jun 19, 2008.

  1. Adem24

    Adem24 Guest

    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! :)))
    Adem24, Jun 19, 2008
    #1
    1. Advertising

  2. Adem24

    Guest

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

    On Jun 19, 12:03 pm, "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>
    >
    > 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 19, 2008
    #2
    1. Advertising

  3. Adem24

    Bill Gates Guest

    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.


    --
    internet = converttostring(hole_internet)
    while(internet != null)
    if (internet.token == "Linux") internet.token.replaceTo("Microsoft");
    Bill Gates, Jun 19, 2008
    #3
  4. Adem24

    Kai-Uwe Bux Guest

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

    wrote:

    > On Jun 19, 12:03 pm, "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>
    >>
    >> 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
    Kai-Uwe Bux, Jun 19, 2008
    #4
  5. Adem24

    Duane Hebert Guest

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

    > 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?
    Duane Hebert, Jun 19, 2008
    #5
  6. Adem24

    Mirco Wahab Guest

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

    Regards

    M.

    f'up comp.lang.c++
    Mirco Wahab, Jun 19, 2008
    #6
  7. Re: Microsoft's so called programmers (ROTFL! :)

    On Jun 19, 5:09 pm, Mirco Wahab <> wrote:
    > 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/library/20dckbeh(VS.71).aspx
    >


    They fixed it in .NET !!!

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

    :)
    Vyacheslav Kononenko, Jun 19, 2008
    #7
  8. Adem24

    Greg Herlihy Guest

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

    On Jun 19, 3:08 pm, Vyacheslav Kononenko
    <> wrote:
    > On Jun 19, 5:09 pm, Mirco Wahab <> wrote:


    > > 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/library/20dckbeh(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
    Greg Herlihy, Jun 20, 2008
    #8
  9. Adem24

    James Kanze Guest

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

    On Jun 20, 5:06 am, Jack Klein <> wrote:
    > On Thu, 19 Jun 2008 12:42:00 -0700 (PDT),
    > 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:
    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
    James Kanze, Jun 20, 2008
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Charles A. Lackman
    Replies:
    1
    Views:
    1,325
    smith
    Dec 8, 2004
  2. SpamProof
    Replies:
    0
    Views:
    531
    SpamProof
    Oct 21, 2003
  3. broli
    Replies:
    3
    Views:
    427
    Kenny McCormack
    Apr 3, 2008
  4. MikeP
    Replies:
    40
    Views:
    1,679
    BartC
    Apr 7, 2011
  5. bert
    Replies:
    1
    Views:
    685
    Nick Keighley
    Apr 6, 2011
Loading...

Share This Page