Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×

Comment Re:It was a terrible example of went to use a goto (Score 1) 677

Note that Torvalds concedes that the specific code example being complained about does not benefit by the use of goto.

Also not brought up in that discussions is that where to draw the line between goto and nesting depends on the amount of nesting and the length of the code in question, not nesting alone. People using goto in shorter simpler code are making the code less readable.

Now Love's example is a great one because of the falling through from one undo to another. Because the bailout applies to all nesting levels so far not just the current level. That would be awkward in purely structured code. However if the undo were constrained to only the err'ing level, if there had been a goto out after undo C and undo B then structured if/else would have been more readable. But as is with multiple levels of undo it is s very appropriate use of goto.

Unfortunately much use of goto is done when the code is simple and short, unlike Love's example.

Comment Most Linux users want *nix not Linux itself ... (Score 1) 393

Last I checked, Hollywood effects companies were all running their serious FX software on Linux desktops.

A lot of industrial grade engineering, scientific, graphics, etc code is *nix based. These users may be running Linux on PC hardware but they don't really want or care about Linux. They want a convenient working *nix to get their work done. Linux is just a convenient option. These people don't really care about the politics, the gpl, etc. If a BSD provided a more convenient option many would migrate.

Comment Re:You sunk my battleship (Score 1) 439

Did you miss the part about aircraft being ineffective at night? The strategic problem of the campaign, for both sides, was that the United States could dominate the skies during the day but had to rely on surface ships at night.

The US carriers were withdrawn due to fear of their loss.

At the beginning of the campaign the Marines were landed and the fleet carriers withdrew a couple of days later. The loss of air cover caused support ships to be withdrawn. Marines ashore watched the majority of their supplies and equipment sail away with those ships.

Escort carries would make runs to within range of Guadalcanal to deliver aircraft to Henderson field. I believe Henderson was the major source of US airpower in the area for a while.

A little over two weeks after withdrawing the fleet carriers came up to intercept a Japanese carrier force coming south. This battle took place well to the north east of Guadalcanal. Aircraft from Henderson engaged forces in the vicinity of Guadalcanal.

If it wasn't for the surface fleet, including battleships, the marines ashore would have been in a bad way to put it mildly.

The Marines were in a bad way. They had less that a weeks food and light on ammunition too. Fortunately they were able to capture some Japanese food.

And yes, to say the surface fleet -- in particular the destroyers and cruisers -- fought valiantly to protect the Marines is an understatement. At times these destroyers and cruisers attacked vastly superior enemy forces on their routine patrols up the slot because they were the only thing between this force and the Marines.

Comment Re:You sunk my battleship (Score 1) 439

Incidentally, the turning point of the war didn't happen at Midway, as is often repeated, but rather it happened at Guadalcanal. Midway was a battle, Guadalcanal was a campaign, one which proved the Japanese were not equipped materially or psychologically to fight a long war.

Midway occurred a month earlier and Imperial Japan lost four fleet carriers and more importantly many of their absolutely best air crews. This alone is arguably a valid turning point. At least in a naval sense and the pacific war was essentially a naval war. Now consider how this loss benefited the US at Guadalcanal. The victory at Midway greatly contributed to the victory at Guadalcanal.

Besides the material benefits Midway destroyed the myth of invincibility of the Imperial Japanese Navy and Guadalcanal destroyed the myth of invincibility of the Imperial Japanese Army and Marines. Both played extremely important roles.

Comment Re:You sunk my battleship (Score 1) 439

Not that it mattered, really, since by the start of the war battleships were really only useful for providing shore bombardment and as AA platforms.

This is dead wrong. Read the history of the Guadalcanal campaign; it was surface ships that carried the day. Aircraft were ineffective at night and are best used in an offensive role, they can't effectively protect ships bringing in troops and supplies

I believe that during parts of the Guadalcanal campaign the aircraft carriers were withdrawn from the area to keep them "safe", well safer. They certainly saw action but toe to toe fleet engagements were being avoided. We were a little short on fleet carriers in 1942.

Also some of the capital ships sunk by aircraft had an assist from surface action. In one of those nighttime surface engagements a US destroyer put 3 torpedoes into a Japanese battleship, greatly reducing her speed. She could not keep up with the retreating fleet and was sunk by US aircraft in the morning when the sun came up.

Comment Used during 80s and 90s too (Score 1) 439

BB's were used as ground fire support in Nam (a co-worker once told me an apocryphal story about a call for fire that got routed to a BB), but other than showing the colors, they really haven't done anything else since.

They were used in the 1980s to shell various hostile positions in Lebanon after the Marine barracks was attacked. This included killing a Syrian general in his command post.

They were also used in the 1991 Gulf War to shell various Iraqi positions.

Comment Re:Apple II emulators ... (Score 1) 166

Switching video modes **mid-scan line** is NOT some "rare" undocumented unsupported hack.

Google it. People who used it back in the day mention it is not supported, relies on a hardware quirk and does not work on all Apple IIs.

It is about achieving 100% cycle accurate emulation.

And achieving 99.x% is an amazing technical achievement and extremely useful.

Comment Re:Not everything is worth saving (Score 1) 166

Not everything needs to be preserved for future historians

With respect, what is and what isn't worth preserving is up to future historians to decide.

Historian don't make such a call, they preserve everything. A cuneiform clay tablet with a receipt for a shipment of wheat is preserved as if it had the story of Gilgamesh on it.

Decisions of what to preserve are more the domain of invading Vandals and the city residents trying to hide things from them.

Comment Goto the exception not the rule ... (Score 1) 677

yeah, GOTO the end and do some cleanup and/or error reporting, which is common to all the gotos. I don't see a problem with that. It's clear, simple and avoid heinous if/else deep nestings.

The problem is goto is not just used in the "heinous" nesting cases. And "heinous" varies with the length of the conditional blocks. If there are many levels but it fits on a screen or two, perhaps leans toward if. If they are stretching for many screens worth of code maybe lean towards goto.

The problem with goto is that the conditional code is at the same nesting level as the unconditional code so it makes it less apparent what code is conditional. Using goto should be the exception, to substitute a smaller problem for a larger problem, not the rule, substituting a small problem for no existing problem at all (minor nesting for short durations).

Comment Re:why? (Score 1) 677

I have written a lot of code in my life - Thousands of projects, millions of lines of code (for whatever that means), across a dozen languages and twice as many platforms. And outside Assembly (and DOS batch, if you want to count that as a "language"), I have not ever encountered a situation where I thought to myself "gee, I could really improve this with a GOTO, if only everyone wouldn't laugh at me for it".

I'm with you there.

I have, however, removed some pretty heinous uses of GOTO from other people's code. The most common one I see, people can't quite bring themselves to "return" from an error handler in the middle of a function, so they instead GOTO the end of it. Really??? Talk about missing the forest for the trees!

You are missing the forest of testing and debugging. :-) Its easier if you just have one place to set a breakpoint.

Slashdot Top Deals

The Tao is like a glob pattern: used but never used up. It is like the extern void: filled with infinite possibilities.

Working...