Much of this is TEPCO's fault, and specifically the fault of their CEO, Masataka Shimizu. A few weeks after the hydrogen explosions, it came out that the CEO had ruled that only he could authorize any release of radioactive material, including venting hydrogen to the atmosphere to avoid an explosion.
When that decision needed to be made, the CEO was not present when wanted. When the earthquake occurred, he happened to be in another part of Japan and had trouble getting to TEPCO HQ. But there was no backup plan if the CEO was unavailable. Nobody took over and made the decision. (In the US, policy is that the on-site plant manager can make that decision.)
The CEO wasn't seen in public for weeks after the disaster.
He was rumored to have fled the country, that he'd committed suicide, or that he was in a hospital.
The Prime Minister of Japan personally went over to TEPCO headquarters to demand answers and action. Even that didn't help, and his office had to directly take over management of the disaster.
Masataka Shimizu is still CEO of TEPCO.
Japan used to have a tradition of seppuku in such situations.
If anyone is entitled to the name, it's Dick Marcinko. He was the first commanding officer of the team he named SEAL Team 6. (There were only two teams at the time; naming it 6 was a deception.) After he left the Navy, he wrote a number of novels about SEAL-type exploits.
HDMI does have some error checking. Each 8-bit byte is sent as 10 bits, to maintain DC balance. The receiving end can detect at least single bit errors. The reaction of most HDMI devices is error concealment, and the error counts are seldom if ever made visible to the user.
Some of the earliest CD players had visible error counters. This was discouraged in consumer devices by industry agreement.
I'm not sure what 80s system it's supposed to be emulating. It's not a BBS. It's not TOPS-20. It's not VMS. It's not SAIL. It's not ITS. It's not an ARPANET TAC. It's not Multics. It's not UNET on UNIX.
Forbes and The Huffington Post have already come out in support of the kid. This is the sort of thing that gets the attention of free-speech organizations. It's an opinion, and protected as such.
He may have a good case for false arrest. Note that he was arrested in his home, for a past event. Was there a warrant from a judge?
Some of bin Laden's home videos have already been released. So clearly the US has a collection of his recorded data. Exactly what was captured isn't being disclosed yet, reasonably enough.
All the people bin Laden communicated with directly are probably trying to find places to hide. They would have done that regardless of what stories came out after bin Laden was killed.
There have been reprisals from bin Laden's supporters in the Taliban. They just attacked a group of Pakistani army trainees, killing 80. Dumb move. The result will probably be more Pakistani cooperation with the US.
The AtMega (the actual CPU) is too weak to use enough data to load down the cellular network. You couldn't, for example, decompress video with it. So people aren't going to build accessories which let you watch TV over your Android connection.
There's nothing wrong with those parts, but they're for tiny programs.
We now have to assume for insurance purposes that, about once every 25 years, a nuclear accident will require evacuation for decades of a 20 to 50km area around the plant. Premiums must be adjusted accordingly.
Did anybody check this? As of right now, thepiratebay.org's home page is up.
More importantly, Bitsavers, an archive or historical technical data,is down, and has been down for days. That site would be a major loss; they have copies of rare documents not available elsewhere. Anyone know what's going on there?
I saw one on the road around noon yesterday, Velodyne inverted-cone scanner rotating on top. This was on I-280 headed southbound between Palo Alto and Cupertino, about ten miles from Google HQ. It stayed centered in lane, going exactly 70mph.
Not clear if it was in autonomous mode or just someone out gathering data. I have a picture, but it's not too good; I just grabbed a Nikon CoolPix and aimed it out the windshield.
With all that work I'm really surprised to see such a lack of taxiway and runway lighting and signage.
All the taxiway and runway lighting is fully operational. Here's the night view.
This isn't just a static display with a little repetitive motion. The planes land, and taxi to the terminal on the taxiways. They position at a gate. The jetways move into position and mate with the plane. Fuel trucks and catering trucks come up to the plane. After a while, the support vehicles move off, and a pushback truck pushes the plane clear of the gate area. The plane then turns, follows the taxiways, gets into the takeoff queue, waits at the threshold, rolls onto the runway, takes off, and disappears through the wall.
The vehicles run on the Faller carsystem, which is used for road vehicles all over Minatur Wunderland. Guidance is via little magnets that follow a metal rail hidden in the table. There are switches at junctions, and the control system is railroad-like. The vehicles are battery powered, and get speed instructions from a central computer, but steering is mechanical, following the track with the magnet.
The planes use the same system when on the ground. When they're in position for takeoff, a rod comes up through the runway and engages a big pocket in the plane. A second rear rod engages a smaller pocket in the rear. Takeoff is driven from equipment under the runway, which can move and tilt the plane. At the end of the room, the plane flies through a row of strips of "sky" painted material and disappears.
Behind the scenes, the planes then are brought down, and return to driving mode. They move around on a hidden lower level and are staged to simulate various flights. There's also automatic charging for all vehicles, which make stops at hidden charging stations as needed.
The airport is only a small part of the whole exhibit, which has a model railroad with 890 trains and 12km of track. There's a staff of 185 people. It's a major tourist attraction.
The House and Senate Intelligence Committees have already been shown the pictures. Once the "Osama was a martyr" stuff dies down in the Islamic world, there's no reason not to release them. It's barely front page news on Al Jazeera any more, although they're doing a bin Laden retrospective. Give it six months, and the pictures will be of historical interest only.
There's really not much question that he's dead. Even al-Queda says he's dead.
The really interesting results of the raid will come out as the intel found on-site is processed. It looks like bin Laden's people didn't have a chance to destroy any data, and their records, computers, and video are in US hands. NSA and CIA people are undoubtedly working around the clock on that data. What's left of al-Queda is probably trying to find a place to hide. (They talk about "martyrs", but that's for the people at the bottom, not the leadership.)
If you go by that argument, I can also point out that alot (sic) of the jocks from high school are now making many, many millions of dollars as professional athletes (NFL, NBA, etc.)
No, not "a lot". Very, very few. This is a common delusion among black youth, thinking they're going to make it big in sports. There are only 30 NBA teams, with 15 players each. Each team has only a few new hires each year, maybe 4. So that's 2.9 million high school graduates potentially competing for 120 jobs.
Competent jocks in team sports tend to do well in life. They know how to perform on a team, and sometimes how to get a team to perform. That's a useful skill.
Years of work, special purpose hardware, a price tag higher than an entire PC, and all it does is generate screen-saver like video wallpaper in sync with audio?
If you're building technology for a rave, build something that makes the track spots follow the dancers. Something the dancers can play with. A Kinect might make that work.
Go to Facebook -> Account -> Apps and Web Sites -> Edit Your Settings ->Apps You Use -> Turn Off Platform Apps.
Even that doesn't stop everything. Go to
Account-> Privacy Settings -> Block LIsts. This is where you see the list of apps you've blocked from contacting you when run by others. But you can't actually block anything from there. You have to find the Facebook page of the annoying app (for example, FarmVille) and then click on "Block App". Now, no more annoying Farmville messages. You may also have to find "Zynga's Players Community" and block that, too. Also, for Foursquare, you need to block both Foursquare and Foursquare Badges.
Yes, you have to do all this just to block the companies whose apps have the intrusion level of an anal probe.
The US has a freight rail system that is the envy of Europe. (Europe is ahead in passenger rail, but that loses money.) Intermodal traffic (containers) is way up over the last decade, and profitable. There's new rail construction going on, and rails and locomotives have been upgraded in recent years.
Modern large locomotives use what are essentially giant computer-controlled servomotors to drive the wheels, so that all the wheels on all the locomotives stay in sync and share the load equally, which means they can all be torqued up to just below where they start to slip. This means fewer locomotives per train, little or no wheel slip, and the ability to coordinate many locomotives spread throughout a train.
Last year, Union Pacific ran a train 3.5 miles long from Los Angeles to Denver. Average freight train length in the US is now 6500 feet and climbing. That replaces a lot of trucks. Since Los Angeles built a no-grade-crossing rail connection to the port there, far fewer trucks are moving to the port.
Europe still has a lot of little 2-axle freight cars. Those disappeared from US trackage some time before World War Two, replaced by the standard big four-axle cars still used today. The bigger cars are also stronger, with a consistent minimum coupler strength, which means longer trains are possible.
Mixing high speed passenger trains and freight on the same track cuts severely into freight capacity. Each passenger train uses up the track time of six freights.
"We're still working to confirm the security of the network infrastructure, as well as working with a variety of outside entities to confirm with them of the security of the system. Verifying the system security is vital for the process of restoration. Additional comprehensive system checks and testing are still required, and we must complete that process before bringing the systems online."
"Working with a variety of outside entities to confirm with them of the security of the system." means
VISA International and/or MasterCard, Inc have invoked their contractual rights to send in auditors, security experts, and computer forensics experts. They do that for big security breaches.
"Additional comprehensive system checks and testing are still required, and we must complete that process before bringing the systems online." means "VISA, etc. won't let us go back on line until we pass their security tests."
So Sony isn't entirely in control of when they go back on line.
You'd be surprised how many non-networking people think wifi is a ip only protocol or even web-traffic only protocol.
Right. We used to use WiFi in Ethernet bridging mode for robot vehicle development, with no connection to the outside world's Internet. Protocols used included QNX QNET directly over Ethernet, not over IP. Nobody does this any more.
I once ran an employment ad "Send us a thousand lines of C++ that you're proud of". Very few people submitted code. Lots of excuses, though. What I was looking for in code, incidentally, was proper paranoia. This was an embedded project for a large machine, and I wanted to see conservative code that would clearly not do bad things. I actually sent one application back with "Your application has been received. Your first buffer overflow is on line 22. Thank you for your interest."
I once encountered an applicant who claimed to be an experienced C++ programmer, and sounded convincing. I sat him down at a computer, demonstrated how to type in, edit, and compile "Hello World" in that environment, and asked him to code something. Anything. He got stuck at "int main...".
If you use the trick as quoted, you can pass the array through several functions easily. The real problem is that you can't store it (in a global or a field), since type of the variable would have to be in scope of template as well.
Right. And that's the problem. It's only useful when size is determined entirely at compile time.
I've no idea what the compiler is supposed to do for your C99 snippet, as C99 is not part of C++ standard.
GCC implements that. I'm not sure whether the C++ committee adopted that from C99 somewhere along the way, or whether that's a GCC extension. It's a big performance win in numerical work. Look at "Numerical Recipes in C", where the classic editions have many allocation calls at the entrance to functions that need scratch arrays.
I once proposed generalizing the C99 feature of allowing dynamically sized arrays at the language level to allowing a similar syntax in all array-related contexts.
This has the same fundamental problems as C99 VLA themselves - it introduces a runtime component to the type system, which is inherently compile-time.
That's what I proposed to extend. The basic concept is that the compiler knows what expression defines the length, but does not store it separately from the programmer-defined expression which defines it. In most useful programs, there is some expression that describes the size of each dynamically allocated array. The problem in C is that the programmer (and maintainers of the code) have to know what that expression is, but can't write it in the language. Microsoft Standard Attribute Notation does have syntax for that, but that's a Microsoft extension.
In C99, the breakage is most immediately seen by the fact that type system does not actually verify that you pass correct size in.... More generally, C99 VLAs, on type system level, are some kind of a weird type where length is "not directly known, but there is an associated value" - so you get types with attached (runtime) values etc.
Exactly. That's the right idea. It's just not general enough yet.
Anyway, in C++ today you just use std::vector and don't care about all this. The only downside there is that it's always heap-allocated, whereas C99 VLAs can be stack-allocated.
Which is why allocation dominates the cost of computation for some common number-crunching functions used on smaller arrays. (I used to do dynamics simulation engines, and had to worry about this.) Also,with std::vector, you take an additional indirection on each reference, although some compilers can optimized that out.
A standard proposal for this exists, calling such a type std::dynarray. So far as I know, it is being considered as part of C++ TR2. If it passes, it would, in my opinion, be the best solution to the problem.
I originally proposed that about a decade ago, but it didn't use enough template features for the Boost crowd. It's good to see that it's finally happening.
If subscript checks are implemented in templates, though, the compiler has to execute them every time.
I'm not sure what you mean by this. A function template, once instantiated, is a function like any other, and any template parameters become simple constants in the instantiation. If you call such a function in a loop, then it's up to the compiler to inline it (and then hoist the check) or not, but this is the same for both template and non-template functions.
The question is whether the compiler is allowed to generate code that detects an error early, before all computation up to the error point has executed. If errors are reported as exceptions when they occur, they're part of normal control flow, and the exception can't be thrown until the error occurs. If the compiler understands that this is an e
He underpriced his offer, but it doesn't have to be a disaster. It's a workflow problem. The photographer gets to schedule the shoots, so he has to get them organized into blocks in the same area. Many people won't have a location in mind, and he can get them to go either to his studio or to one of several pre-selected scenic locations. Once set up in a location, customers can be run through in an hour each. Customers who insist on a specific location have to wait longer for a time slot to open up.
The post-processing work is also a workflow problem. For most shots, a minute or two in Photoshop is enough. Those can be farmed out to an intern, or even some site like GetAFreelancer. The paper printing, DVD making, and framing gets done in bulk, with bids from various companies.
If half the people who bought the coupon actually use the service, and the photographer is organized about it, it's probably about six weeks of work.
The photographer can up-sell. Want hair, makeup,or costuming? Available for an extra charge. Some of the business will be wedding-related, and that's an opportunity to sell a whole wedding package.
Online gaming, as in a MMORPG, is fine. What's seriously objectionable are supposedly standalone games that insist on constantly checking in with a DRM server to work at all. They should forbidden the use of the term "buy" or "sell" in advertising, and should be required to advertise their products as rentals.
Nor should PC game installs require administrator privileges or installation of services. Game companies can't be trusted with those privileges given their track record.
This isn't really a search problem. The problem is break-ins to vulnerable sites that replace site content with phony pages leading to attacks. Google is finding the phony pages and indexing them. Mostly it's a WordPress or PHP problem.
That said, in C++ (which is what we were talking about), it is, in fact, very easy to pass an array by reference without losing its size.
That trick only works in a few contexts, ones where the array size is known at compile time, has not yet been lost by the language and "sizeof" will still work. If you pass the array through to another function, the size is lost. Even
int n = 10;
int d[n];// works, C99 extension
foo(d);// fails, template won't match.
won't work.
I once proposed generalizing the C99 feature of allowing dynamically sized arrays at the language level to allowing a similar syntax in all array-related contexts. Then you'd have UNIX read declared as
int read(int fd, char(&buf)[n], size_t n);
instead of passing "buf" as "char *", which is a lie to the language. The function now knows the size of the array, which would be accessible via "sizeof()" and "lengthof()" and usable for subscript checking. But there are no array descriptors or template code bloat. You've simply told the compiler what you're really doing, instead of lying to it by passing an array as "char *"
It turns out that you can almost, but not quite, retrofit this compatibly. So it's too much of a change for C or C++ at this late date.
Incidentally, subscript checking is cheap if the compiler knows what's going on and can hoist subscript checks out of loops. For most FOR loops, subscript checks can be done once at loop start or even optimized out entirely. If subscript checks are implemented in templates, though, the compiler has to execute them every time. That's why a macro-based approach is inferior.
They're probably doing this to compete with Wilow Garage, which has their own open-source robot operating system.
Much of this is TEPCO's fault, and specifically the fault of their CEO, Masataka Shimizu. A few weeks after the hydrogen explosions, it came out that the CEO had ruled that only he could authorize any release of radioactive material, including venting hydrogen to the atmosphere to avoid an explosion.
When that decision needed to be made, the CEO was not present when wanted. When the earthquake occurred, he happened to be in another part of Japan and had trouble getting to TEPCO HQ. But there was no backup plan if the CEO was unavailable. Nobody took over and made the decision. (In the US, policy is that the on-site plant manager can make that decision.)
The CEO wasn't seen in public for weeks after the disaster. He was rumored to have fled the country, that he'd committed suicide, or that he was in a hospital. The Prime Minister of Japan personally went over to TEPCO headquarters to demand answers and action. Even that didn't help, and his office had to directly take over management of the disaster.
Masataka Shimizu is still CEO of TEPCO.
Japan used to have a tradition of seppuku in such situations.
If anyone is entitled to the name, it's Dick Marcinko. He was the first commanding officer of the team he named SEAL Team 6. (There were only two teams at the time; naming it 6 was a deception.) After he left the Navy, he wrote a number of novels about SEAL-type exploits.
Disney is way out of line here.
HDMI does have some error checking. Each 8-bit byte is sent as 10 bits, to maintain DC balance. The receiving end can detect at least single bit errors. The reaction of most HDMI devices is error concealment, and the error counts are seldom if ever made visible to the user.
Some of the earliest CD players had visible error counters. This was discouraged in consumer devices by industry agreement.
I'm not sure what 80s system it's supposed to be emulating. It's not a BBS. It's not TOPS-20. It's not VMS. It's not SAIL. It's not ITS. It's not an ARPANET TAC. It's not Multics. It's not UNET on UNIX.
Forbes and The Huffington Post have already come out in support of the kid. This is the sort of thing that gets the attention of free-speech organizations. It's an opinion, and protected as such.
He may have a good case for false arrest. Note that he was arrested in his home, for a past event. Was there a warrant from a judge?
Some of bin Laden's home videos have already been released. So clearly the US has a collection of his recorded data. Exactly what was captured isn't being disclosed yet, reasonably enough.
All the people bin Laden communicated with directly are probably trying to find places to hide. They would have done that regardless of what stories came out after bin Laden was killed.
There have been reprisals from bin Laden's supporters in the Taliban. They just attacked a group of Pakistani army trainees, killing 80. Dumb move. The result will probably be more Pakistani cooperation with the US.
The AtMega (the actual CPU) is too weak to use enough data to load down the cellular network. You couldn't, for example, decompress video with it. So people aren't going to build accessories which let you watch TV over your Android connection.
There's nothing wrong with those parts, but they're for tiny programs.
We now have to assume for insurance purposes that, about once every 25 years, a nuclear accident will require evacuation for decades of a 20 to 50km area around the plant. Premiums must be adjusted accordingly.
Did anybody check this? As of right now, thepiratebay.org's home page is up.
More importantly, Bitsavers, an archive or historical technical data,is down, and has been down for days. That site would be a major loss; they have copies of rare documents not available elsewhere. Anyone know what's going on there?
I saw one on the road around noon yesterday, Velodyne inverted-cone scanner rotating on top. This was on I-280 headed southbound between Palo Alto and Cupertino, about ten miles from Google HQ. It stayed centered in lane, going exactly 70mph. Not clear if it was in autonomous mode or just someone out gathering data. I have a picture, but it's not too good; I just grabbed a Nikon CoolPix and aimed it out the windshield.
With all that work I'm really surprised to see such a lack of taxiway and runway lighting and signage.
All the taxiway and runway lighting is fully operational. Here's the night view.
This isn't just a static display with a little repetitive motion. The planes land, and taxi to the terminal on the taxiways. They position at a gate. The jetways move into position and mate with the plane. Fuel trucks and catering trucks come up to the plane. After a while, the support vehicles move off, and a pushback truck pushes the plane clear of the gate area. The plane then turns, follows the taxiways, gets into the takeoff queue, waits at the threshold, rolls onto the runway, takes off, and disappears through the wall.
The vehicles run on the Faller carsystem, which is used for road vehicles all over Minatur Wunderland. Guidance is via little magnets that follow a metal rail hidden in the table. There are switches at junctions, and the control system is railroad-like. The vehicles are battery powered, and get speed instructions from a central computer, but steering is mechanical, following the track with the magnet.
The planes use the same system when on the ground. When they're in position for takeoff, a rod comes up through the runway and engages a big pocket in the plane. A second rear rod engages a smaller pocket in the rear. Takeoff is driven from equipment under the runway, which can move and tilt the plane. At the end of the room, the plane flies through a row of strips of "sky" painted material and disappears.
Behind the scenes, the planes then are brought down, and return to driving mode. They move around on a hidden lower level and are staged to simulate various flights. There's also automatic charging for all vehicles, which make stops at hidden charging stations as needed.
The airport is only a small part of the whole exhibit, which has a model railroad with 890 trains and 12km of track. There's a staff of 185 people. It's a major tourist attraction.
The House and Senate Intelligence Committees have already been shown the pictures. Once the "Osama was a martyr" stuff dies down in the Islamic world, there's no reason not to release them. It's barely front page news on Al Jazeera any more, although they're doing a bin Laden retrospective. Give it six months, and the pictures will be of historical interest only.
There's really not much question that he's dead. Even al-Queda says he's dead.
The really interesting results of the raid will come out as the intel found on-site is processed. It looks like bin Laden's people didn't have a chance to destroy any data, and their records, computers, and video are in US hands. NSA and CIA people are undoubtedly working around the clock on that data. What's left of al-Queda is probably trying to find a place to hide. (They talk about "martyrs", but that's for the people at the bottom, not the leadership.)
If you go by that argument, I can also point out that alot (sic) of the jocks from high school are now making many, many millions of dollars as professional athletes (NFL, NBA, etc.)
No, not "a lot". Very, very few. This is a common delusion among black youth, thinking they're going to make it big in sports. There are only 30 NBA teams, with 15 players each. Each team has only a few new hires each year, maybe 4. So that's 2.9 million high school graduates potentially competing for 120 jobs.
Competent jocks in team sports tend to do well in life. They know how to perform on a team, and sometimes how to get a team to perform. That's a useful skill.
Years of work, special purpose hardware, a price tag higher than an entire PC, and all it does is generate screen-saver like video wallpaper in sync with audio?
If you're building technology for a rave, build something that makes the track spots follow the dancers. Something the dancers can play with. A Kinect might make that work.
Go to Facebook -> Account -> Apps and Web Sites -> Edit Your Settings ->Apps You Use -> Turn Off Platform Apps.
Even that doesn't stop everything. Go to Account-> Privacy Settings -> Block LIsts. This is where you see the list of apps you've blocked from contacting you when run by others. But you can't actually block anything from there. You have to find the Facebook page of the annoying app (for example, FarmVille) and then click on "Block App". Now, no more annoying Farmville messages. You may also have to find "Zynga's Players Community" and block that, too. Also, for Foursquare, you need to block both Foursquare and Foursquare Badges.
Yes, you have to do all this just to block the companies whose apps have the intrusion level of an anal probe.
The US has a freight rail system that is the envy of Europe. (Europe is ahead in passenger rail, but that loses money.) Intermodal traffic (containers) is way up over the last decade, and profitable. There's new rail construction going on, and rails and locomotives have been upgraded in recent years.
Modern large locomotives use what are essentially giant computer-controlled servomotors to drive the wheels, so that all the wheels on all the locomotives stay in sync and share the load equally, which means they can all be torqued up to just below where they start to slip. This means fewer locomotives per train, little or no wheel slip, and the ability to coordinate many locomotives spread throughout a train.
Last year, Union Pacific ran a train 3.5 miles long from Los Angeles to Denver. Average freight train length in the US is now 6500 feet and climbing. That replaces a lot of trucks. Since Los Angeles built a no-grade-crossing rail connection to the port there, far fewer trucks are moving to the port.
Europe still has a lot of little 2-axle freight cars. Those disappeared from US trackage some time before World War Two, replaced by the standard big four-axle cars still used today. The bigger cars are also stronger, with a consistent minimum coupler strength, which means longer trains are possible.
Mixing high speed passenger trains and freight on the same track cuts severely into freight capacity. Each passenger train uses up the track time of six freights.
Sony:
"We're still working to confirm the security of the network infrastructure, as well as working with a variety of outside entities to confirm with them of the security of the system. Verifying the system security is vital for the process of restoration. Additional comprehensive system checks and testing are still required, and we must complete that process before bringing the systems online."
To understand this, read VISA International's "What to Do if Compromised..
"Working with a variety of outside entities to confirm with them of the security of the system." means VISA International and/or MasterCard, Inc have invoked their contractual rights to send in auditors, security experts, and computer forensics experts. They do that for big security breaches. "Additional comprehensive system checks and testing are still required, and we must complete that process before bringing the systems online." means "VISA, etc. won't let us go back on line until we pass their security tests."
So Sony isn't entirely in control of when they go back on line.
You'd be surprised how many non-networking people think wifi is a ip only protocol or even web-traffic only protocol.
Right. We used to use WiFi in Ethernet bridging mode for robot vehicle development, with no connection to the outside world's Internet. Protocols used included QNX QNET directly over Ethernet, not over IP. Nobody does this any more.
I once ran an employment ad "Send us a thousand lines of C++ that you're proud of". Very few people submitted code. Lots of excuses, though. What I was looking for in code, incidentally, was proper paranoia. This was an embedded project for a large machine, and I wanted to see conservative code that would clearly not do bad things. I actually sent one application back with "Your application has been received. Your first buffer overflow is on line 22. Thank you for your interest."
I once encountered an applicant who claimed to be an experienced C++ programmer, and sounded convincing. I sat him down at a computer, demonstrated how to type in, edit, and compile "Hello World" in that environment, and asked him to code something. Anything. He got stuck at "int main...".
If you use the trick as quoted, you can pass the array through several functions easily. The real problem is that you can't store it (in a global or a field), since type of the variable would have to be in scope of template as well.
Right. And that's the problem. It's only useful when size is determined entirely at compile time.
I've no idea what the compiler is supposed to do for your C99 snippet, as C99 is not part of C++ standard.
GCC implements that. I'm not sure whether the C++ committee adopted that from C99 somewhere along the way, or whether that's a GCC extension. It's a big performance win in numerical work. Look at "Numerical Recipes in C", where the classic editions have many allocation calls at the entrance to functions that need scratch arrays.
I once proposed generalizing the C99 feature of allowing dynamically sized arrays at the language level to allowing a similar syntax in all array-related contexts.
This has the same fundamental problems as C99 VLA themselves - it introduces a runtime component to the type system, which is inherently compile-time.
That's what I proposed to extend. The basic concept is that the compiler knows what expression defines the length, but does not store it separately from the programmer-defined expression which defines it. In most useful programs, there is some expression that describes the size of each dynamically allocated array. The problem in C is that the programmer (and maintainers of the code) have to know what that expression is, but can't write it in the language. Microsoft Standard Attribute Notation does have syntax for that, but that's a Microsoft extension.
In C99, the breakage is most immediately seen by the fact that type system does not actually verify that you pass correct size in. ... More generally, C99 VLAs, on type system level, are some kind of a weird type where length is "not directly known, but there is an associated value" - so you get types with attached (runtime) values etc.
Exactly. That's the right idea. It's just not general enough yet.
Anyway, in C++ today you just use std::vector and don't care about all this. The only downside there is that it's always heap-allocated, whereas C99 VLAs can be stack-allocated.
Which is why allocation dominates the cost of computation for some common number-crunching functions used on smaller arrays. (I used to do dynamics simulation engines, and had to worry about this.) Also,with std::vector, you take an additional indirection on each reference, although some compilers can optimized that out.
A standard proposal for this exists, calling such a type std::dynarray. So far as I know, it is being considered as part of C++ TR2. If it passes, it would, in my opinion, be the best solution to the problem.
I originally proposed that about a decade ago, but it didn't use enough template features for the Boost crowd. It's good to see that it's finally happening.
If subscript checks are implemented in templates, though, the compiler has to execute them every time.
I'm not sure what you mean by this. A function template, once instantiated, is a function like any other, and any template parameters become simple constants in the instantiation. If you call such a function in a loop, then it's up to the compiler to inline it (and then hoist the check) or not, but this is the same for both template and non-template functions.
The question is whether the compiler is allowed to generate code that detects an error early, before all computation up to the error point has executed. If errors are reported as exceptions when they occur, they're part of normal control flow, and the exception can't be thrown until the error occurs. If the compiler understands that this is an e
He underpriced his offer, but it doesn't have to be a disaster. It's a workflow problem. The photographer gets to schedule the shoots, so he has to get them organized into blocks in the same area. Many people won't have a location in mind, and he can get them to go either to his studio or to one of several pre-selected scenic locations. Once set up in a location, customers can be run through in an hour each. Customers who insist on a specific location have to wait longer for a time slot to open up.
The post-processing work is also a workflow problem. For most shots, a minute or two in Photoshop is enough. Those can be farmed out to an intern, or even some site like GetAFreelancer. The paper printing, DVD making, and framing gets done in bulk, with bids from various companies.
If half the people who bought the coupon actually use the service, and the photographer is organized about it, it's probably about six weeks of work.
The photographer can up-sell. Want hair, makeup,or costuming? Available for an extra charge. Some of the business will be wedding-related, and that's an opportunity to sell a whole wedding package.
Online gaming, as in a MMORPG, is fine. What's seriously objectionable are supposedly standalone games that insist on constantly checking in with a DRM server to work at all. They should forbidden the use of the term "buy" or "sell" in advertising, and should be required to advertise their products as rentals.
Nor should PC game installs require administrator privileges or installation of services. Game companies can't be trusted with those privileges given their track record.
This isn't really a search problem. The problem is break-ins to vulnerable sites that replace site content with phony pages leading to attacks. Google is finding the phony pages and indexing them. Mostly it's a WordPress or PHP problem.
That said, in C++ (which is what we were talking about), it is, in fact, very easy to pass an array by reference without losing its size.
That trick only works in a few contexts, ones where the array size is known at compile time, has not yet been lost by the language and "sizeof" will still work. If you pass the array through to another function, the size is lost. Even
int n = 10; // works, C99 extension // fails, template won't match.
int d[n];
foo(d);
won't work.
I once proposed generalizing the C99 feature of allowing dynamically sized arrays at the language level to allowing a similar syntax in all array-related contexts. Then you'd have UNIX read declared as
int read(int fd, char(&buf)[n], size_t n);
instead of passing "buf" as "char *", which is a lie to the language. The function now knows the size of the array, which would be accessible via "sizeof()" and "lengthof()" and usable for subscript checking. But there are no array descriptors or template code bloat. You've simply told the compiler what you're really doing, instead of lying to it by passing an array as "char *" It turns out that you can almost, but not quite, retrofit this compatibly. So it's too much of a change for C or C++ at this late date.
Incidentally, subscript checking is cheap if the compiler knows what's going on and can hoist subscript checks out of loops. For most FOR loops, subscript checks can be done once at loop start or even optimized out entirely. If subscript checks are implemented in templates, though, the compiler has to execute them every time. That's why a macro-based approach is inferior.