|
Try:
if (foo) {
goto NoFoo;
}
NoFoo:
...
|
|
|
|
|
More complete is
var foo = true;
Foo: if (foo) {
goto Foo;
} My first C# program! On the PDP-10, it was far more concise: jrst@.
modified 6-Apr-21 6:37am.
|
|
|
|
|
It is only empty if you look at it.
|
|
|
|
|
MISRA (and other quality standards) rules, they require either a comment or an empty statement in all the execution paths. Helps finding missing implementations or typing / copy-pasting errors before releasing.
If you don't mind you can simply write
if (foo)
{
;
}
Ohterwise Disabling ESLint rules[^] will help.
GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
Thankfully I don't have to follow MISRA. Some of it is the worst a*al retentive dross I've seen, and all responsible should be looking for jobs in boys' choirs.
modified 6-Apr-21 9:13am.
|
|
|
|
|
Believe me, there is worse than MISRA.
Core MISRA makes sense, as in "wrap every condition in its own parenthesis", "explicitly define the behavior of every execution path" and so on. There are several quality measurements that are totally bonkers, as in "function X is called more than 5 times in its module, it is WRONG". No reason at all, just PITA.
GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
Yes, but the comment may let the linter infer that the programmer recognizes that the block is empty and said something useful about it in the comment.
When the linter starts making snarky remarks about what's in the comments, I'll retire .
Software Zen: delete this;
|
|
|
|
|
Please, for the love of all things good in this world
Stop using mm/dd/yyyy for the numerical date format
Only the US, US jurisdictions, and Swahili in Kenya use this format, so 6/7/2021 means two completely different things to someone in the US and someone in the UK. Or NZ, Or Oz. Or, well, anywhere else really.
Please: make dates unambiguous. Use month abbreviations like 6-Jul. Use yyyy-mm-dd if you have to. Or go crazy and sniff a user's preferences but that doesn't actually work because everyone in the US seems to think Canada uses the US format. Canada doesn't use the US format: It merely understands the US format which I find astounding. Show a Canadian 6/7 and they'll tell you the correct interpretation without context. It's a skill akin to national mind reading and I do not understand how they do it.
cheers
Chris Maunder
|
|
|
|
|
context?
Also, I agree if the app/site will never be used outside the United States (i.e. internal business apps and sites).
|
|
|
|
|
Slacker007 wrote: context?
Probably he saw a date like 4/7 and was unsure if it was tomorrow, or 3 months from now.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
|
|
|
|
|
Whether it's mm/dd or dd/mm, I start looking for numbers higher than 12 to be sure of what the hell is intended.
|
|
|
|
|
ISO 8601 has existed for a coupla decades now. It is the _only_ Atandard.
|
|
|
|
|
most people do not write in ISO-8601. Most people want to see their dates in a familiar format; a format they write in.
I know you don't give an elephant's turd, but I had to say it none the less.
|
|
|
|
|
I write in ISO 8601. Done.
|
|
|
|
|
I (usually) write in ISO 8601 for the complete avoidance of doubt, my own and anyone else's.
Unless I know that my audience will actually be confused by ISO 8601, that is!
|
|
|
|
|
I will change my styles tomorrow
diligent hands rule....
|
|
|
|
|
Yes. And I wish the USA will bite the bullet for once and all and drop the idiotic imperial system and go METRIC!
Get me coffee and no one gets hurt!
|
|
|
|
|
I see that as less of an issue as it is not (usually[1]) prone to lack of clarity as dd-mm vs. mm-dd is.
One can measure accurately in Imperial or Metric, so it's purely a matter of personal preference. I see nothing inherently idiotic about Imperial. It's quirky and inconsistent but then so are many things.
Footnote:-
1: Yes, yes, I know that some very expensive things have blown up or gone off course due to Metric/Imperials mixups. But that was due to lack of project management clarity and QC/QA, rather than the existence of two measurement systems.
|
|
|
|
|
Metric will only be complete when there's a metric calendar, a metric clock, and a metric angular measurement.
|
|
|
|
|
Metric Angular Measure: Gradian. One down, two to go...
|
|
|
|
|
Shortly after the revolution in France there was a suggestion that the week should have 10 days, the day 10 hours and the hour 100 minutes. This was abandoned quickly. The people only had one or two free days every 10 days, so they rebelled, and all timekeeping devices would have to be swapped out. One sensible suggestion was that the year should have 12 months of 30 days plus 5 or 6 epagomenal days per year at the end of a month.
One still sees calculators with 100° in a quadrant as an option
|
|
|
|
|
And I wish the UK would drop the idiotic metric system and revert to imperial. One of the many benefits of which, is that people need to use their brains when thinking about and calculating weights and measures.
|
|
|
|
|
Yes this so much more logical and less idiotic than the metric system.
It is ordained that 3 grains of barley dry and round do make an inch, 12 inches make 1 foot, 3 feet make 1 yard, 5 yards and a half make a perch, and 40 perches in length and 4 in breadth make an acre.
|
|
|
|
|
Tony Hill wrote: It is ordained that ...
Yea, verily! I've seen the light*, brother!
* And it is an approaching train.
Seriously, the only inherent advantages of the Metric system are that:
- It eases conversions between units (cm in a kilometer is much easier to calculate than inches in a mile)
- The Metric system has a MASS unit, while the Imperial system has a WEIGHT unit (of importance to natural scientists and to anyone or anything that goes into space)
OTOH, only the US, Liberia, and Myanmar still use the Imperial system, and the US, at least, uses a debased version where there are 16 fluid ounces to the pint, rather than the divinely ordained 20. Even in the US, scientists are taught the Metric system.
I would say that the battle for metricization has been won.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Apart from the fact the imperial system has nice familiar names there are no advantages to using imperial but I guess some people will never change.
I am only glad we were using the metric system when I did my engineering college course as some of the other imperial units are completely nuts.
|
|
|
|