lol wtf TETRIS!!!

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

Mon Aug 10, 2009 2:32 pm

  • Why should it generate entirely different machine code?
    Alien
    Forum addon
     
    Posts: 1212
    Joined: Tue Apr 22, 2008 7:12 am

Mon Aug 10, 2009 4:11 pm

  • compilers for any language (including Assembly) handle "else" and "else if" differently when compiling.
    +The Dude+
    [-Project 2501-]
    Mizu Kitsune
    Alien trapper
     
    Posts: 362
    Joined: Sat Apr 11, 2009 7:51 pm
    Location: Maridia

Mon Aug 10, 2009 5:32 pm

  • This is not a question of else if {} and else {} but between else if {} and else { if {}}
    Alien
    Forum addon
     
    Posts: 1212
    Joined: Tue Apr 22, 2008 7:12 am

Tue Aug 11, 2009 1:04 am

Tue Aug 11, 2009 4:31 am

  • Alien wrote:This is not a question of else if {} and else {} but between else if {} and else { if {}}

    what i just explained. else if {} is handled differently than else { if {}} is when compiled.

    [quote=mand1nga]best thread ver[/quote]
    ^_^
    +The Dude+
    [-Project 2501-]
    Mizu Kitsune
    Alien trapper
     
    Posts: 362
    Joined: Sat Apr 11, 2009 7:51 pm
    Location: Maridia

Tue Aug 11, 2009 7:15 am

  • Really?
    Code: Select all
    >more else1.c
    int main(void)
    {
        if (1) {}
        else
        {
            if (1) {}
        }
        return 0;
    }

    >more else2.c
    int main(void)
    {
        if (1) {}
        else
            if (1) {}

        return 0;
    }

    >icl else1.c
    -out:else1.exe
    else1.obj

    >icl else2.c
    -out:else2.exe
    else2.obj

    >fc else1.exe else2.exe
    Comparing files else1.exe and ELSE2.EXE
    000000E8: [color=red]9F A2[/color]

    >pedump else1.exe
    Dump of file ELSE1.EXE

    File Header
      Machine:                      014C (i386)
      Number of Sections:           0003
      TimeDateStamp:                4A8117[color=red]9F[/color] -> Tue Aug 11 10:02:55 2009
      PointerToSymbolTable:         00000000
      NumberOfSymbols:              00000000
      SizeOfOptionalHeader:         00E0
      Characteristics:              0103
        RELOCS_STRIPPED
        EXECUTABLE_IMAGE
        32BIT_MACHINE
      .
      .
      .

    >pedump else2.exe
    Dump of file ELSE2.EXE

    File Header
      Machine:                      014C (i386)
      Number of Sections:           0003
      TimeDateStamp:                4A8117[color=red]A2[/color] -> Tue Aug 11 10:02:58 2009
      PointerToSymbolTable:         00000000
      NumberOfSymbols:              00000000
      SizeOfOptionalHeader:         00E0
      Characteristics:              0103
        RELOCS_STRIPPED
        EXECUTABLE_IMAGE
        32BIT_MACHINE
      .
      .
      .


    TimeDateStamp: 4A81179F -> Tue Aug 11 10:02:55 2009
    TimeDateStamp: 4A8117A2 -> Tue Aug 11 10:02:58 2009
    Alien
    Forum addon
     
    Posts: 1212
    Joined: Tue Apr 22, 2008 7:12 am

Tue Aug 11, 2009 7:44 am

  • Nexuiz is written in qc. And I heard there are several bugs in the compiler.
    So there might indeed be a difference in machine code.

    @Alien: Why did you write else and if on different lines? Should it not be "else if" on 1 line?
    User avatar
    morfar
    Site Admin
     
    Posts: 938
    Joined: Tue Feb 28, 2006 6:08 pm
    Location: The Island

Tue Aug 11, 2009 10:00 am

Tue Aug 11, 2009 11:55 am

  • Code: Select all
    else3.c:

    int main(void)
    {
        if (1) {}
        else

             ;;;;;;  {}
            ;;  ;;;; {}
                 ;;; {}
                ;;;  {}
               ;;    {}
               ;;    {}

               ;;    {}


            if (1) {}

        return 0;
    }



    else4.c:

    int main(void)
    {
        if (1) {}
        else if (1) {}

        return 0;
    }

    >fc else3.exe else4.exe
    Comparing files else3.exe and ELSE4.EXE
    000000E8: 99 94


    Basically, punctuation marks are read and used only by lexical analysis tool which is usually part of compiler suite.

    Image
    Alien
    Forum addon
     
    Posts: 1212
    Joined: Tue Apr 22, 2008 7:12 am

Tue Aug 11, 2009 3:25 pm

Tue Aug 11, 2009 4:13 pm

  • i believe we are talking QuakeC rather than C.
    +The Dude+
    [-Project 2501-]
    Mizu Kitsune
    Alien trapper
     
    Posts: 362
    Joined: Sat Apr 11, 2009 7:51 pm
    Location: Maridia

Tue Aug 11, 2009 4:24 pm

Tue Aug 11, 2009 4:31 pm

Tue Aug 11, 2009 4:31 pm

  • Code: Select all
    void ifelif()
    {
       if(TRUE)
       {
          print("true\n");
       } else if(FALSE) {
          print("false\n");
       }
    }


    fteqcc -Fwasm:
    Code: Select all
    void () ifelif;
    void() ifelif = asm
    {
            IFNOT           FILE_APPEND,    4;
            STORE_F "true
    ",      parm0_x;
            CALL1           print;
            GOTO            4;
            IFNOT           KEY_GAME,       3;
            STORE_F "false
    ",      parm0_x;
            CALL1           print;
            DONE;
    }



    ---


    Code: Select all
    void ifelif()
    {
       if(TRUE)
       {
          print("true\n");
       } else {
          if(FALSE)
             print("false\n");
       }
    }


    fteqcc -Fwasm:
    Code: Select all
    void () ifelif;
    void() ifelif = asm
    {
            IFNOT           FILE_APPEND,    4;
            STORE_F "true
    ",      parm0_x;
            CALL1           print;
            GOTO            4;
            IFNOT           KEY_GAME,       3;
            STORE_F "false
    ",      parm0_x;
            CALL1           print;
            DONE;
    }
    Meh.
    User avatar
    Mr. Bougo
    Keyboard killer
     
    Posts: 760
    Joined: Mon Sep 10, 2007 3:29 pm

Tue Aug 11, 2009 5:09 pm

  • Don't be so constructive!
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Tue Aug 11, 2009 5:29 pm

  • But that's deconstructive!
    Meh.
    User avatar
    Mr. Bougo
    Keyboard killer
     
    Posts: 760
    Joined: Mon Sep 10, 2007 3:29 pm

Tue Aug 11, 2009 6:34 pm

  • ai wrote:
    Mizu Kitsune wrote:i believe we are talking QuakeC rather than C.

    QC and C is basically the same thing right? That's how I understood it, so there shouldn't really be any differences (or the huge at least) in those cases.

    completely different.
    +The Dude+
    [-Project 2501-]
    Mizu Kitsune
    Alien trapper
     
    Posts: 362
    Joined: Sat Apr 11, 2009 7:51 pm
    Location: Maridia

Tue Aug 11, 2009 7:09 pm

Tue Aug 11, 2009 7:52 pm

Tue Aug 11, 2009 9:39 pm

Wed Aug 12, 2009 12:30 pm

  • Well, see my asm compile, the two if elif structures yield the same machine code.
    Meh.
    User avatar
    Mr. Bougo
    Keyboard killer
     
    Posts: 760
    Joined: Mon Sep 10, 2007 3:29 pm

Fri Aug 14, 2009 6:03 am

  • Sure fteqcc -Fwasm is lying ;)
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Sun Aug 23, 2009 8:09 am

  • Tetris enabled on nexrun server. :P
    User avatar
    FruitieX
    Keyboard killer
     
    Posts: 588
    Joined: Mon Nov 13, 2006 4:47 pm
    Location: Finland

Previous


Return to Nexuiz - Development




Information
  • Who is online
  • Users browsing this forum: No registered users and 1 guest