Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
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.
-
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 -
This is so inefficient. It keeps checking whole year just for 1 day. Use Cron Job Dude.
-
@theabbie the cron job still technically has to check what day it is too every minute
-
@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.
-
@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.
-
@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
Related Rants
I want to see if you guys can solve this. This was from a year ago
question
brain teaser
programming question