home bbs files messages ]

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

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

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

   Message 3,499 of 4,675   
   Bart to Rick C. Hodgin   
   Re: Fast Fizz Buzz program   
   22 Jul 18 13:48:31   
   
   From: bc@nospicedham.freeuk.com   
      
   On 22/07/2018 12:56, Rick C. Hodgin wrote:   
   > On Saturday, July 21, 2018 at 7:27:49 PM UTC-4, Bart wrote:   
   >> Is it that simple? The first error in your code was that 'num' was not   
   >> defined. So I moved that further up.   
   >   
   > I only see one error in the code posted in this thread.  I   
   > forgot to remove the "int num" parameter from other().  It   
   > should've been void.   
   >   
      
    >      void other(void)        { printf("%d\n", num);   }   
    >   
    >      void (*funcs[4])(int) = { other, fizz, buzz, fizzbuzz };   
    >   
    >      int num;   
    >   
      
   Problem 1: the body of other() uses 'num', which is not defined until later.   
      
   Problem 2; funcs[4] is declared as function pointers taking an int,   
   although it is initialised to functions which take no arguments, and the   
   pointers are called with no arguments.   
      
   Now you mention an 'int num' parameter, which I can't see in your code,   
   so a potential Problem 3.   
      
   It is anyway not a simple typo that anyone can see at a glance. More   
   importantly, if code hasn't been run, then we don't know if it's going   
   to work, especially after ad hoc modifications by someone else who   
   doesn't know what you had in mind.   
      
   That's why I went with Ben's version just to get a ball-park performance   
   figure for a C version of the algorithm.   
      
   --   
   bart   
      
   --- 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