Lets just call them Bob and George



  • Something I saw today in something I was looking at. This is one of those simple things that still left me scratching my head.

    
    int function( type_t arg0, type_t arg1, int foo )
    {
        type_t a0 = arg0;
        type_t a1 = arg1;
        ...
    

    arg0 & arg1 are never used again throughout the rest of the function. I was inside a couple of nested code blocks when I saw this, so it took me some time to work my way back and find where a0 & a1 came from.

    I guess this must have seemed easier than just changing the name of the arguments, at the time.



  • @Vanders said:

    I guess this must have seemed easier than just changing the name of the arguments, at the time.
    A lot of things seem like good ideas when you're drunk and high.  It's just part of the fun.



  • The original non-anonymized version might have had good reason to avoid renaming the arguments (e.g. the language allows passing arguments in a different order by specifying their names, or includes the arguments in auto-generated documentation) but still want to give them shorter aliases within the body (especially if the actual savings was more than 2 characters per name).

     



  • @emurphy said:

    The original non-anonymized version might have had good reason to avoid renaming the arguments (e.g. the language allows passing arguments in a different order by specifying their names, or includes the arguments in auto-generated documentation) but still want to give them shorter aliases within the body (especially if the actual savings was more than 2 characters per name). 

    It looks like C, so it probably doesn't have named parameters.  Maybe the programmer thought he couldn't change the names of the arguments in the prototype without breaking binary compatibility or something.. 



  • @emurphy said:

    The original non-anonymized version might have had good reason to avoid renaming the arguments (e.g. the language allows passing arguments in a different order by specifying their names, or includes the arguments in auto-generated documentation)

     

     

     

    Nope, it's C. You don't even have to name the arguments in the prototype if you don't feel like it, and it was from a small piece of self-contained code that doesn't warrant anything as grand as generated documentation.



  • I just realized what the title of the thread meant!  That's funny.  Sounds like something Spectate might do.   Call his video object bob and his seconds counter george.  And then name inmail.txt after his mom.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.