|
I agree, but I do them as a learning event. Places I have never heard of.
One has to use a map for those small island ones and even then it requires multiple guesses to narrow it down.
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
I often feel like code review are mostly filled with unneeded comment for the sake of commenting or to take some sort of "ownership" that doesn't do anything special beside burdening the reviewee with a special cosmetic change udpate.
Anyway, someone was updating my code and I was feeling revengeful so I also asserted my opinion on purely cosmetic and totally irrelevant code!
Although, come to think of it, the guy was doing unnecessary work in Dispose() because "that's what is done everywhere", even though it's not needed and closing documents take godamn too long (due to all those unnecessary piece of code running in all those Dispose() methods), mmmrrppphhh... I stick to my gun!
modified 30-Jan-23 22:55pm.
|
|
|
|
|
Super Lloyd wrote: Anyway, someone was updating my code One of my earlier co-workers discovered that my code contained a '#define ever ;;' so that I could write an infinite loop as 'for (ever) { ...'. A few years earlier, I was working in a CHILL environment; in CHILL 'DO FOR EVER' is a part of the base language.
This construction made my coworker so upset that he not only changed it where he had discovered it; he searched through the entire code base of the company for other uses, and found a good handful; I had been programming with 'for (ever) {' for a couple of years by then (in embedded software, infinite loops are commonplace), changing every one of them to 'while (0) {', adding an angry commit comment that requested everybody to refrain from making such 'jokes' in our program code - we are a serious company!
Then he brought it up at the scrum, to make sure that everybody would know that in our company, we do not code that way.
I asked if we could make it slightly less cryptic by using 'while (true) {', but this fellow would not under any circumstances accept that. According to him, there is one, single way of coding an infinite loop, that is immediately recognized by every programmer in the world, and that is 'while (0)'. So he would not tolerate anything else.
He certainly had no formal authority, completing his degree about three years earlier, having worked in the company for half a year, I was 25 years his senior. I didn't have to accept his dictate. But he had an unbearable arrogance and self confidence that I didn't care to fight against, so I just nodded "OK!".
At least that episode gave me a story to tell - this is certainly not the first time
|
|
|
|
|
Mmmh.... shouldn't it be while (1) ?
Now I am worried your colleague might have broken lots of stuff...
Fun story though! I quite like the for (ever)
|
|
|
|
|
for the spiritualists: Do while( 1 ) { I = Live(); };
for the materialists: Do while( 1 ) { I = Make_Money(); };
P.S. No offense intended just being a silly programmer about forever.
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
Do while (ever) { I = TryToLive() && MakeMoney(); }
|
|
|
|
|
try
{
Be_Born();
while (1)
{
try
{
Live();
Make_Money();
}
catch (FinancialException const& e)
{
}
catch (MedicalException const& e)
{
}
}
}
catch (DeathException const& e)
{
Die();
}
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
makes sense!
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
excellent. You nailed it.
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
Super Lloyd wrote: Mmmh.... shouldn't it be while (1)? Of course! Sorry about that typo. I prefer 'for (ever)'
|
|
|
|
|
I faced a similar situation years ago, and met a similar response. Largely because the people "across the pond" could not get their heads around how time zones work, and the 24-hour clock.
|
|
|
|
|
trønderen wrote: 'while (0)' What on earth does that do?
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
|
Sorry about the typo - if you had read the response from Super Lloyd and my reply to him, you would have known.
I never use 'while (1)' myself - I think of it as a deliberate case of explicit code obfuscation.
Another common practice in the same company was to enclose code under development in 'if (0) {...', to have it syntax checked even though it was not ready for execution yet. I guess that is what caused me to write 'while (0)' rather than 'while (1)'.
|
|
|
|
|
Compared with while(1) , (8 keystrokes) for(ever) has 9 keystrokes and is a distant third place from for(;;) at only 7 keystrokes
Sorry I'm lazy; I was born that way.
Mircea
|
|
|
|
|
APL is the language for you!
|
|
|
|
|
A bit verbose that one. I'll stick with Brainfuck[^]
Mircea
|
|
|
|
|
I once wrote a program with a variable
int hell_freezes_over = 0;
The loop control was
do
...
until hell_freezes_over
The languange didn't support infinite loops.
|
|
|
|
|
I did something similar, but my symbol was WW3.
A friend of mine pointed out that I was a romantic dreamer: I had defined WW3 as a false constant
|
|
|
|
|
And what is wrong with the idiom:
for (;;)
{
}
Which has no spurious conditions?
Inquiring minds wish to know!
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
trønderen wrote: According to him, there is one, single way of coding an infinite loop, that is immediately recognized by every programmer in the world, and that is 'while (1)' (Changed the 0 to 1 per your earlier replies)
Lint may disagree with his assertion that while(1) {} is the only and preferred way to write a loop - I have had it prefer the for(;;) construct and both are versions that are easily recognised.
I wouldn't personally be a fan of "#define ever ;;" as it "feels" fragile both in requiring the definition be included consistently and the risk someone may one day want to name a variable or function as that. Would be something for an interesting private discussion rather than "show and tell" at a scrum meeting, however!
|
|
|
|
|
trønderen wrote: his construction made my coworker so upset that he not only changed it where he had discovered it; he searched through the entire code base of the company for other uses, and found a good handful; I had been programming with 'for (ever)
Myself I take the view that I am working in and for a business. So I write code with the view that someone in the future will need to read my code, understand it, and modify it to meet the needs which I cannot possibly predict when I write the code. So I try to make the code as easy to understand as possible.
So it is not what I want but rather how to best produce something that is more useable for the future.
|
|
|
|
|
You speak of of your conclusion as if it was universal. Maybe your workplace culture leads to poor code reviews. That does not mean that code reviews cannot be done in a productive way. Cheerz.
"If we don't change direction, we'll end up where we're going"
|
|
|
|
|
well.. lucky you. the larger the team the higher the chance to have that coworker (those coworkers?) who wants to micromanage reviews
|
|
|
|
|
Very true. Perhaps even more true for large companies. Also true: there are many more reasons to avoid large companies, if you value your sanity.
"If we don't change direction, we'll end up where we're going"
|
|
|
|