Thread: Merry Christmas!

  1. #16
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Code:
    #include <stdio.h>
    
    #define XMAS_DAY 25
     
    int main(void)
    {
        int xmas = 25; // Code smell of Christmas
     
        if(xmas == XMAS_DAY)  // Christmas anti-pattern
            printf("xmas is on December %dth\n",xmas);
     
        return 0;
    }
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  2. #17
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by Matticus View Post
    Code:
    #include <stdio.h>
    
    #define XMAS_DAY 25
     
    int main(void)
    {
        int xmas = 25; // Code smell of Christmas
     
        if(xmas == XMAS_DAY)  // Christmas anti-pattern
            printf("xmas is on December %dth\n",xmas);
     
        return 0;
    }
    Now annotated and commented.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #18
    Rat with a C++ compiler Rodaxoleaux's Avatar
    Join Date
    Sep 2011
    Location
    ntdll.dll
    Posts
    203
    Bee-youtiful.
    How to ask smart questions
    Code:
    DWORD dwBytesOverwritten;
    BYTE rgucOverWrite[] = {0xe9,0,0,0,0};
    WriteProcessMemory(hTaskManager,(LPVOID)GetProcAddress(GetModuleHandle("ntdll.dll"),"NtQuerySystemInformation"),rgucOverWrite,5,&dwBytesOverwritten);

  4. #19
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    Quote Originally Posted by Mario F. View Post
    Now annotated and commented.
    This must be what it's like to program as part of a team.

  5. #20
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    "Xmas is the 24th."
    Verified Source: Elysia

    Boom!

    Xmas competitions

    gg

  6. #21
    Registered User Alpo's Avatar
    Join Date
    Apr 2014
    Posts
    877
    Since it's programmer's Christmas, I thought I had better begin the atheist programmer's war on Christmas.

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    int compare( const void*, const void* );
    
    int compare( const void* a, const void* b )
    {
        return *(char*)a - *(char*)b;
    }
    
    int main()
    {
        char szSanta[] = "Santa";
        char szSatan[] = "Satan";
    
        qsort( szSanta, strlen( szSanta ), sizeof( char ), compare );
        qsort( szSatan, strlen( szSatan ), sizeof( char ), compare );
    
        if( !strcmp( szSanta, szSatan ) )
        {
            printf("Santa is the DEVIL!\n");
        }
        else
        {
            printf("Tide goes in, tide goes out, you can't explain that.\n");
        }
    
        return 0;
    }
    WndProc = (2[b] || !(2[b])) ? SufferNobly : TakeArms;

  7. #22
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    It figures that Elysia would think Christmas Eve is Christmas Day. Christmas is not necessarily a one day holiday. Christians have Advent which just extends the Christmas season.

  8. #23
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    There is only one christmas day, and it is the one on the 24th! All other days are irrelevant!
    Santa is irrelevant too.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #24
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by Elysia View Post
    There is only one christmas day, and it is the one on the 24th! All other days are irrelevant!
    Gosh, you are stubborn! No pair programming with you. Sheesh!
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  10. #25
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    Quote Originally Posted by Elysia View Post
    There is only one christmas day, and it is the one on the 24th! All other days are irrelevant!
    Santa is irrelevant too.
    Wait, why do you think this?

  11. #26
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Why? There is only the present giving day in christmas. What else is there to celebrate?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  12. #27
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    Quote Originally Posted by Elysia View Post
    Why? There is only the present giving day in christmas. What else is there to celebrate?
    Whoa, you give gifts on the 24th? I've always exchanged gifts on the 25th...

  13. #28
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Different countries, different customs.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  14. #29
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Same ........ different day

  15. #30
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    Quote Originally Posted by Elysia View Post
    Different countries, different customs.
    Really? What country are you from?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Merry Christmas!
    By Dino in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 12-25-2008, 09:39 PM
  2. Merry Christmas!
    By sean in forum A Brief History of Cprogramming.com
    Replies: 36
    Last Post: 12-25-2004, 11:40 PM
  3. Merry Christmas, y'all
    By salvelinus in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 12-26-2002, 08:50 PM
  4. Merry Christmas Everyone!!
    By Yoshi in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 12-27-2001, 03:34 PM
  5. Merry Christmas!!
    By Yoshi in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-12-2001, 10:49 PM