Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Memory leak detection?
Goto page Previous  1, 2
 
Post new topic   Reply to topic Printable version
 View previous topic  Quick Question #3 Post :: Post Quick question.  View next topic  
Author Message
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Wed Dec 15, 2004 5:48 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

My point was that
Dr Brain wrote:
Of course, it's still possible to write obscure code, but the compiler wont give up without a fight

that wasn't true.

You can never trust a compiler to do well what the programmer should do himself.
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Wed Dec 15, 2004 8:00 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

You think the compiler never complained to the programmer who wrote that? It's possible, but I think it's unlikely.
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Wed Dec 15, 2004 9:43 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

Check this out:

Some nice C code for you. See if you can figure out what it is before you compile and run.

(This was part of the 2001 IOCCC)

Code: Show/Hide
#include <time.h>
#include <stdio.h>
#include <stdlib.h>

#define __ "Y\n : ! ,.?>"
#define D(f) ; } int f(int i) { return
#define E(a,b,c,d,e) b##d,c,e,a
#define e(a,b,c,d) a##b##c##d
#define B *p++ - ' ' || !p++
#define _(k) o(*#k - 64)
#define G(g,l,k,o,e,d,n,c,i,b,a,f,j,m,p) \
a#b#c#d#e#f#g#a#i#j#k#l#m#n#o e,i l##c,m##b; d g j n h(k 30:1); o p f}

         G(E(f ( 9) -s
            ? -s + 'q'
            ? f( 5 ) -s &&'d' -
                s?U(  3 ) ||_(J)
            :A ( s- f( 5 ))
            :(c= 4 *
               4):

   g(0)D(

      V)c <= 3 *4 + 3&&c && V(X ( i) ) ;
   }

   int , time ( 0)& , c - 15 || P

   (1

):0,
   & ( !!d       ( 0 )
     ||(a=! _(S)) ,b= 0 )||
   a
      ?d(a  = 0)
         ? _
(I):         w ( j =!W(j=_ (V ))) ,

            l(_
                (Y+ s ) )
              )e

   (
   main(){;
       ;;;s , ra,
    n, d), && C ( j +R( s-j+t( i- 1) )
         )D( W)m[ c* 4| z( j ) ]
       &&_( X )E (d      ( 0
             )&&  R( 6)/ 6
            ? c= 17|_ ( T )
            :01,||+
                , v =i & 3 ^ 2
                ,+j & 3&&W ( j)||y ( 10 )D (k) --
               j ? k ( O[j]=R(15 ))
: 1 D
          ( H )o ( 7+! !  i+3 )+

              i?

    c=i /4 & 63,
    a= 1

:0)

    D ( f )( p =M ,q ( i),*p+86)
    D ( l) * f, B?

            B ?B ?B? B ?B ?B
       ?7 :B?B ?36: 59 * 89 *5 * 2 :B?6587
        *77 :9 + 2:B ?B?B?9: 5 : 37 : B ? 5 +5:4:20:
                B?B?B?32

        :e( 4, 3 , 1 *4 * 59  * 1 , 7):B?
                17: 34 : 19 :B ?
                  8 *2 :B ?
                  2:26: B?
                   B?B ?B ?

   82 *+ 576: B ?33 :22  :5 * 5:3 *4 :3:B ?B ?B? B ?6 +
   + 17 : B?B?13:6 : 9 *2:B?15 : 7 *2 :

             B ?
             B ?
             27:24: 31 : B?


        B? +  29 :,
        m [a^ 2  ] =T( 8 * 7) ;j= 3
            ;
          ;
         Q, ;int
          P ( int
        i )

      {time_t(x )            =+ 0+
   time(0) ;                       j=E( u (i  ) : i D(R )e(r ,
      a ,n ,d) ()% i+1,                 ( e( l  , o,
      caltim , e ) (& x))     ->e(          tm_h , o, u  , r)
   ;retur ,            i?_( W
):   _( U) D(Y)           *p&&  *p<3 * 11 ?
     ( ++ p ),              n j= + 34  +( j< 6
                     ||j>19 ),Y (i)
: *p

    D ( F)   i == 9  ?1 :
   F(   (i+ 7)% ( 7 +  3) ) +!O[ i
   ]D(u)   *p &&* p -32? p ++)
    D (h  )   i ?*++*S=i%  ( 38)- 1,
    D ( A )!    n?i&&!g ( (0  ) ) ||K (  j=4| ! !i ) :  N(!i )D(
                Q)++j<

          (s )  &&Q ( t( i)^i )
    D( U   )i>= 0 ?U( i- 1 )||~f (i+1 ) == ~  s
                  &&H (m[c* 4 |z(i)] )
:0;D


      ( X) + b && b<, for (*S = M  ; *
p; ),

      gets ( L, + 98 , stdin ) ?
         p= L, E (r( 0 ): 0 ,h( i /  38 ) : 0;D( C)!
         ( m[j]+m [a= i] ) ?m[j[m]= i]=j:0;D (d) !
           b+(*  O-
            c)*
              *  O; D (z )


                     -~- ~ -~i +
   v
      & 3 D(y)( putchar ) ( i)
    D ( q )   i& ,!(O[j = i]
       || _ ( O))+a :0;
    D (w)O[   j] ==c && o

   (( !i ++ ? ! !_ (M

):

   0) +15)|| ++ j<9 &&w (
i)D   ( r )*p?         *p -4?
               * p -6 ?
                 y(*p <9 + 2?__[
                   * p
]:          * p+ 7 +79):o( j+1) : o (26+j),&q ( -!
        * p ++ + i )D(x)i? a=x ( ( -- i)), ++ p )
       D( t ) i,   | C((j=i*
       T(i-4 ))  +R
    (3 ) + 4 )
   D(J) !j                                --E( 0 D  ( K )!-!N, || i &,
                                                _( R ) :i* c== (O
   [ j ] )            &&n==f (j+   6  +    5   * 4)?O
    [j]=            !i *    c-_   (    L)    :J(i )
    D ( N )         j=9, & d(0 )? j= 6 | ! i , J(i )D
         ( o)(*S = p , ++ S,p = M , r (q (i) ),-- S,  p = *S))
          ( (l (_ (Q )),n =s,i ^5 ) ) ;, E(j ,
      sign ,  v ,ed ( b ) ;;
         int   c =1 ,O[9])
            ;int(  s
)=
    E (n ;char, 1 ,a,6 ,o ())*  Z[
   E(M [37 * 9 *3 ] ,0,L [ 99] ,3] , * *S=Z ) ;
    E (*p=+1 ,char( m)[6 , co , 4 ],ol)
              +,
      V ( v=*O = k( j= 9 )) ;
   return ! c&& - ~ ~ - -! printf
    ( ( "%d \n") , F (P ( 0) +6)            *50 + !  ! b*
     ( +b - (int)time ( 0 )) )
;, (         b= 60 + time ( 0)+ 60 * 4)              ;, n =Y
              (u (s =Y (i) ) )

   :  (exit(                                      0)
   ,i)D( g )x (  _(N) ^ 9)? !( a =0) : _  ( P )D (T)!  i|,
   (2); s=35; Q(3);

   s=59; Q(6);


   a=1;




    )
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Wed Dec 15, 2004 1:17 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Dr Brain wrote:
You think the compiler never complained to the programmer who wrote that?

Well it didn't complain to me, so I don't see why it would've to him.

And about your code, yes, I realize that it's quite fun and easy to obfuscate C code, but that wasn't my point. My point was, as I had said before, you shouldn't rely on the compiler to prevent it. A language is not better just because it has a "smarter" compiler or more rigid style control
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:37
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Wed Dec 15, 2004 1:22 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Netcat's code made me freak out already (well, I saw Qndre's weird code before, but that didn't make sense) but wtf is this?!
Back to top
View users profile Send private message Add User to Ignore List
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Wed Dec 15, 2004 2:44 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Cyan~Fire wrote:
[..]


Well it didn't complain to me, so I don't see why it would've to him.

And about your code, yes, I realize that it's quite fun and easy to obfuscate C code, but that wasn't my point. My point was, as I had said before, you shouldn't rely on the compiler to prevent it. A language is not better just because it has a "smarter" compiler or more rigid style control


You only saw the finished product. Someone who codes like that is bound to run into a few compiler errors along the way.

No, that C code had nothing to do with the point I was making. I just posted that for fun, and it vaguely related to this topic.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Wed Dec 15, 2004 2:59 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

hold on lemme get some stuff from my cs class last year, we did stuff from http://www.robocode.net

my favorite

that folder has a bunch of the other ones in it too, I forget if mine's in there or not
_________________

Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Wed Dec 15, 2004 4:55 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

That code has functions and multicharacter variable names.

My teammate wrote some demonstation code (code to help teach others) without a single function, just a main loop, and with every variable name consisting of one letter. He also felt that tabulation was completly optional, and consistant tabulation wasn't important.


Last edited by Dr Brain on Thu Dec 16, 2004 8:28 pm, edited 1 time in total
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Thu Dec 16, 2004 8:08 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

I realize its readable, but it makes me want to claw my eyes out

this one is also funny
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Blindmonkey21
Server Help Squatter


Age:36
Gender:Gender:Male
Joined: Jul 08 2004
Posts: 252
Location: Arizona
Offline

PostPosted: Thu Dec 16, 2004 10:27 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Woah it is just code distort no reason to claw your eyes out...
Back to top
View users profile Send private message Add User to Ignore List AIM Address MSN Messenger
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Thu Dec 16, 2004 11:13 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Blindmonkey, you don't know what you're talking about.

Yah, that code is pretty bad, d1.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Fri Dec 17, 2004 6:23 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

Are they actually using those arrays or is it just to test garbage collection?
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Guest



Offline

PostPosted: Sat Dec 18, 2004 2:33 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Probably used to introduce some sort of delay.
Back to top
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Tue Dec 21, 2004 8:24 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

That guy was funny (and very random), I think he just didn't want it to work. He was very successful at that, but he didn't crash the whole program. The computers we use are so crappy, I doubt it got through the first array before dying
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Trash Talk All times are GMT - 5 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 55 page(s) served in previous 5 minutes.

phpBB Created this page in 0.673007 seconds : 38 queries executed (80.7%): GZIP compression disabled