4

I want to see if you guys can solve this. This was from a year ago

Comments
  • 20
    There is nothing to solve. DAY wasn't declared as volatile, which is why the compiler optimised away the whole party loop. There's no happiness because of an eternal shitload of stupid programming mistakes and badly tagged memes.
  • 12
    Error on line 1: symbol "happy" not declared
  • 7
    Wouldn’t it make sense to make it a regular while loop?

    while(day==256){
    print “happy programmer day”
    }

    The “do” will execute at least once, even if it isn’t programmer day lol
  • 4
    This is so inefficient. It keeps checking whole year just for 1 day. Use Cron Job Dude.
  • 3
    @theabbie the cron job still technically has to check what day it is too every minute
  • 1
    @Matthewb There must be an efficient version of cron job, maybe some way to bind it with existing clock. The clock will trigger the function.
  • 2
    @theabbie its efficient because its baked into the os lol
  • 2
    @Matthewb Then it might not be checking every minute if it's once a year. And it would be much better than running a while loop without any timer continuosly for 1 year.
  • 7
    the fuck is this shit?
  • 5
    Get this out of the question category
  • 1
    pseudo-viral pseudocode images are pretty cancer tbh.
  • 2
    @theabbie it depends, cron has many folders but assuming its put in the top level config, every minute cron looks at the config, checks the cron parameters of a line, if its a valid time to execute the line it reads the supplied command and runs it. So for a cron parameter where is has a very specific date it would actually have to do a date check of some kind. But you are correct, a while loop would be less efficient because it runs every clock cycle, cron is every minute. Clock cycle < a minute
Add Comment