home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c      Meh, in C you gotta define EVERYTHING      243,370 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 243,368 of 243,370   
   Tim Rentsch to DFS   
   Re: Sort of trivial code challenge - may   
   06 Mar 26 18:14:04   
   
   From: tr.17687@z991.linuxsc.com   
      
   DFS  writes:   
      
   > On 3/6/2026 11:53 AM, Tim Rentsch wrote:   
   >   
   >> Lew Pitcher  writes:   
   >>   
   >>> Thanks for the observations.  I look forward to seeing /your/ code :-)   
   >>   
   >> I'm eager to post it.   
   >   
   > It's time!   
   >   
   >   
   >> I'm still hoping DFS will at least post an attempt.   
   >   
   > You're an optimist.  You'd make a good lion tamer.   
   >   
   > "disallow if, for, while, goto, return, and to forbid functions and   
   > function calls except for calls to C standard library functions.  Also   
   > no math library."   
   >   
   > would probably take me 3 days solid to research and write   
   >   
   > I did deliver a "no fors, whiles, gotos, or returns" version.   
   >   
   > Then I bowed out.   
      
   Have you looked up setjmp()/longjmp() yet in the C standard (or   
   maybe do an online search)?  That could help jog your thinking,   
   and once you get the main idea things might fall into place   
   fairly quickly.   
      
   I say again that ?: is an important part of the battle here.   
      
   Feeling merciful, I am giving one more big hint.  The outline of   
   my program looks like this   
      
       ...   
       ... a few #include's, macros, typedef's, variable declarations   
       ...   
      
       static jmp_buf jb;   
      
       int   
       main( int argc, char *argv[] ){   
           switch(  setjmp( jb )  ){   
               ...   
               ... (inside the switch there are several 'case' arms)   
               ... (however there are no 'break' statements used)   
               ...   
           }   
       }   
      
   Obviously some longjmp()'s are needed in the body of the switch() to   
   make this all work.  Good luck!   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca