Assuming a comment won't fit (or can't go) on the line it applies to, should one write the comment before the code or after?

Well, wherever future readers will best understand the comment's scope. In other words, wherever most programmers/scripters put such comments.

So where do most programmers/scripters put a comment: before or after its code?

If your answer applies only to specific languages, please indicate which.

And if you can cite an accepted spec or guide that supports your answer, so much the better.


Question: Quartz cron expression of 0/0
Answer: You can find the result by using TriggerUtils.computeFireTimesBetween() :

try {
        CronTriggerImpl cron = new CronTriggerImpl();

        cron.setStartTime(new Date());
        cron.setCronExpression("0 0/0 * * * ?");

        BaseCalendar calendar = new BaseCalendar();
        List&lt;Date&gt; result = TriggerUtils.computeFireTimesBetween(cron, calendar, new Date(),DateBuilder.futureDate(1, IntervalUnit.DAY));

        for (Date date : result) {
            System.out.println(date);
        }

    } catch (ParseException e) {
        e.printStackTrace();
    }


and the output is :

Thu Apr 05 18:00:00 CST 2012
Thu Apr 05 19:00:00 CST 2012
Thu Apr 05 20:00:00 CST 2012
Thu Apr 05 21:00:00 CST 2012
Thu Apr 05 22:00:00 CST 2012
Thu Apr 05 23:00:00 CST 2012
Fri Apr 06 00:00:00 CST 2012
Fri Apr 06 01:00:00 CST 2012
Fri Apr 06 02:00:00 CST 2012
Fri Apr 06 03:00:00 CST 2012
Fri Apr 06 04:00:00 CST 2012
.......................


So , 0 0/0 * * * ? will run at every hour at 0 mins and 0 sec.