C Puns

This is a discussion on C Puns within the General Discussions forums, part of the Community Boards category; How you know it's late at night: you're reading the glibc manual and you think you see an entry on ...

  1. #1
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185

    C Puns

    How you know it's late at night:
    1. you're reading the glibc manual and you think you see an entry on strfry
    2. you test it out and find it exists
    3. you post it here

  2. #2
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Quote Originally Posted by tabstop View Post
    How you know it's late at night:
    1. you're reading the glibc manual and you think you see an entry on strfry
    2. you test it out and find it exists
    3. you post it here
    Yes, it's a crazy function, isn't it? But at least it doesn't beat libc's memfrob. Look it up. It's amazing.
    I think kryptkat must have used that...

  3. #3
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    OK, what kind of drugs were they on when they created strfry()?
    That has to be one of the most useless functions I've ever seen.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  4. #4
    Just a pushpin. bernt's Avatar
    Join Date
    May 2009
    Posts
    426
    I love the GNU "easter egg" error messages.

    — Macro: int ED

    The experienced user will know what is wrong.

    — Macro: int EGREGIOUS

    You did what?

    — Macro: int EIEIO

    Go home and have a glass of warm, dairy-fresh milk.

    — Macro: int EGRATUITOUS

    This error code has no purpose.
    Consider this post signed

  5. #5
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by cpjust View Post
    OK, what kind of drugs were they on when they created strfry()?
    Probably really good ones, is the impression I sometimes get. Aren't these people descended from the SF bad boys who brought the world FreeBSD?

    That has to be one of the most useless functions I've ever seen.
    It actually says that in the man page.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  6. #6
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Useless crap like this has no business being in professional software like gcc.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  7. #7
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Out of humor on a Sunday night? It's going to be a long week.

    And I don't think we can blame gcc for what people do with it.

  8. #8
    chococoder
    Join Date
    Nov 2004
    Posts
    515
    Quote Originally Posted by cpjust View Post
    Useless crap like this has no business being in professional software like gcc.
    except that
    1) gcc is not professional software (or wasn't when created) but a hobby project
    2) most professional software has easter eggs of some sort in it created as a joke by its programmers. It's fun trying to get things past QA

  9. #9
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by cpjust View Post
    Useless crap like this has no business being in professional software like gcc.
    If by "professional" you mean completely joyless and devoid of humour, and with all possible humanity bleached out, well -- have fun at work today, you really shouldn't be using this unprofessional crap. I am sure there are plenty of sterile, labotomized alternatives around to choose from.

    RMS has acknowledged a fondness for puns, nb.
    Last edited by MK27; 04-12-2010 at 05:06 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  10. #10
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Ahhh, come on cpjust. Humour is fairly important in life... And, really, strfry might even be useful for those too lazy to actually code their own shuffle algorithm. And memfrob... Well, okay, that IS completely useless.

    I think, however, that all hello world tutorials should be changed into this:
    Code:
    #define _GNU_SOURCE
    #include <stdio.h>
    #include <string.h>
    
    int main()
    {
    	char hello[] = "Hdellloorw!, ";
    	strfry(hello);
    	printf("%s\n", hello);
    }
    It may print hello world every once in a very long while.

  11. #11
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,794
    hmm... since strfry() relies on rand(), if it does not use srand(), then we could figure out a particular seed for a particular implementation of strfry() that causes that hello world tutorial to print "Hello, world!" and then augment that example program with this suitable srand() call.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  12. #12
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by laserlight View Post
    hmm... since strfry() relies on rand(), if it does not use srand(), then we could figure out a particular seed for a particular implementation of strfry() that causes that hello world tutorial to print "Hello, world!" and then augment that example program with this suitable srand() call.
    Pretty sure it uses srand(time(NULL)) since if you run EVOex's code twice in rapid succession you get the same result, otherwise it varies.

    So all you need to do is figure out the next second that will produce "Hello, world!" on your RNG. We could announce them like eclipses:

    Next concurrance of the EVOex theorem on May 3rd at 5:25:26 AM GMT! (Intel P4 only)

    That is, if cpjust does not report anyone for wasting time with this silliness. Then we get sent to the forth circle of hell, which is partially reserved for people exhibiting unprofessional behavior, and/or joking around.
    Last edited by MK27; 04-12-2010 at 06:02 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  13. #13
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Hmmm it uses its own random number generator:
    http://www.google.com/codesearch/p?h...fry.c&q=strfry

    It seeds with the time XOR'ed with the PID...

    But I can build something for this... Let me see...


    LOL @ MK27
    Last edited by EVOEx; 04-12-2010 at 07:51 AM.

  14. #14
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by jwenting View Post
    except that
    1) gcc is not professional software (or wasn't when created) but a hobby project
    2) most professional software has easter eggs of some sort in it created as a joke by its programmers. It's fun trying to get things past QA
    Quote Originally Posted by MK27 View Post
    If by "professional" you mean completely joyless and devoid of humour, and with all possible humanity bleached out, well -- have fun at work today, you really shouldn't be using this unprofessional crap. I am sure there are plenty of sterile, labotomized alternatives around to choose from.

    RMS has acknowledged a fondness for puns, nb.
    1. It doesn't matter how it started, gcc IS professional software. Almost everyone on UNIX uses it these days.
    2. There are plenty of other sources of humor out there.
    3. Adding useless functions to gcc makes its code & executables a bit larger than they need to be as well as the man pages.
    4. If I'm looking through a list of available functions to use, I don't feel like wasting my time running into crap like this and saying "hey, I wonder what this does?" Then waste time looking at the man page. I get paid to work, not waste time; so when I do waste time, I'd rather waste it doing something I like.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  15. #15
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Quote Originally Posted by cpjust View Post
    1. It doesn't matter how it started, gcc IS professional software. Almost everyone on UNIX uses it these days.
    2. There are plenty of other sources of humor out there.
    3. Adding useless functions to gcc makes its code & executables a bit larger than they need to be as well as the man pages.
    4. If I'm looking through a list of available functions to use, I don't feel like wasting my time running into crap like this and saying "hey, I wonder what this does?" Then waste time looking at the man page. I get paid to work, not waste time; so when I do waste time, I'd rather waste it doing something I like.
    And I suppose one day you'll discover the difference between gcc and glibc.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Programming Puns
    By kermi3 in forum A Brief History of Cprogramming.com
    Replies: 44
    Last Post: 03-23-2002, 03:38 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21