Slashdot Mirror


User: Christian+Smith

Christian+Smith's activity in the archive.

Stories
0
Comments
328
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 328

  1. And because C++ is slightly more typesafe (strict aliasing), those optimizers can do more for C++ code than for C. So despite the more complex language, C++ can be marginally faster (~1%).

    Probably not even that. In the tiny number of cases where strict aliasing buys you anything at all (which on modern out-of-order hardware it almost never does), it's around the same order of magnitude as the performance that you lose in C++ due to maintaining exception handling information. There's really nothing between C and C++ given the same code these days. In practice, most of the performance gains in C++ come from metaprogramming.

    Exception handling in modern C++ compilers incurs no overhead other than a small amount of memory that isn't referenced until the exception is thrown. Search for table driven exception handling.

    In fact, exception handling should improve performance in the common case, as you'll be reducing the constant "if (failed) {recover()}" operations employed by regular return code error handling. The non-error code path will be much more linear, with fewer pipeline busting branches.

  2. Re:problems, lol on C Programming Language Hits a 15-Year Low On The TIOBE Index (businessinsider.com) · · Score: 3, Informative

    Exceptions are possible in C. See the documentation for setjmp() and longjmp().

    That said, exceptions are just "kicking the can down the road" for error handling. If a function call can fail, then you should check the return code. If you don't want to write with proper error reporting/recovery code immediately, there is always the assert() macro, e.g.:

    if(func_which_might_fail() == ERROR_OCCURRED) assert(0);

    If assert(0) gets called the program will stop immediately, and you can inspect the problem in detail with a debugger. Easy peasy.

    Urgh, no. Never, ever do this. assert() usually becomes a no-op when compiling stuff without debug flags, so binaries shipped to the field will mysteriously ignore errors in ways that can't be reproduced in a debugger.

    One thing that shouldn't change between debug and production code is error detection and handling. In this sense, exceptions are ideal, as handling only needs to happen as and when errors occur, and the common case of no errors incurs little (setjmp/longjmp) to no (exception tables) overhead.

    Plus exceptions are less laborious to handle. You can have a single try/catch for a whole block of code, instead of testing and handling each and every function that could fail. If you write exception safe code, then that's all you need to do, and you can clean up failed operations in the exception handlers.

  3. C doesn't have portable exceptions. And it's problematic to get this done efficiently while C is used in many environments where efficiency is necessary (no room for extra stuff on the stack, or no room for exception tables in code space, etc).

    Single threaded exceptions with setjmp/longjmp can be implemented very cheaply and portably with just a fixed size static array, and a counter to track the nesting level. So long as you don't recursively try/catch, this should be good for small environments, and can be nicely wrapped in CPP goodness for syntactic sugar and easy portability to larger and/or threaded environments (which may require a more sophisticated exception stack.) While setjmp/longjmp can have a performance cost, if it makes error handling easier, then the cost may well be worth it in higher reliability. Make it work first, then make it fast.

    You'd have to be very resource constrained or trivial to make it impractical to use an exception model for error handling.

    In C++ I have seen that 99% of exception handling is all for error handling only, and throws to main() to do just print an error message then exit. Even many C++ books give examples where the arguments to throw are always error messages. In general, in most languages I see very few programmers who "handle" errors or exceptions in a more sophisticated way than just print an error and pop back to the main loop.

    Which may be perfectly valid, so long as you don't leak resources. Just abandoning the current transaction and moving on to the next might be perfectly adequate so long as proper diagnostics are available so that someone can determine why the failure occurred if required. However, making code exception safe can be non-trivial.

  4. The only problem with the terminology is that there is a disconnect between what the common person on the street thinks the capabilities of an autopilot is versus its actual capabilities. An actual autopilot is not much more than an airplane cruise control that maintains a preset altitude, heading, and airspeed, while the common perception is that it is essentially an autonomous robot pilot that can do everything up to and including dogfighting while the human pilot takes a nap.

    I'm not sure how that is Tesla's problem? They spell out what the autopilot is capable of, what the driver's responsibilities are etc.

    Also, I assume the big rig driver is being taken to task in all this? He was essentially at fault for the whole incident, lets not forget.

  5. Re:the CO2 improvements are minor at best on VW Has Emissions-Cheating Fix Ready, Says Report (pressherald.com) · · Score: 1

    Diesel engines emit 15-20% more CO2 per unit volume (liter/gallon) of fuel burned because the fuel contains more energy/carbon.

    And they use less fuel, because they're more efficient.

    And once the companies stop cheating, the fuel economy of the Diesel just isn't all that much better than a turbo gas engine.

    Why put up with extra NOx and particulates (depending on the car you compare to) to save such a small amount of CO2? Just get a gas hybrid and do better all around. Or a plug-in hybrid like the Volt where you can do most of your driving burning no liquid fuel at all?

    Or even better, have a plug in diesel hybrid, where you can trundle round town on the battery and so not emit NOx in built up areas (where NOx emissions matter) then fire up the diesel for extended journeys on open roads where NOx matters less.

    Diesel engines are just more efficient than even turbo gasoline engines, largely due to not being throttled and being lean burn. At low loads (which is probably where engines spend most of their time) diesels have less pumping losses (due to unrestricted throttle-less induction) and direct fuel injection.

  6. Re:Really, this happens in America? How?? on Verizon Begins Charging a Fee Just to Use an Older Router (dslreports.com) · · Score: 2

    >Seriously, if this happened in the UK there'd be a gigantic 'fuck off' from the customers

    Wait, wait, are we talking about the same UK where the citizens have to pay for a 'TV license'?

    The very same UK where that TV license funds an independent, unbiased and world renowned BBC. BTW, my phone, 50mbps broadband, cable TV and TV license still comes out less than the figures bandied about here from US ISPs (assuming the $130/month price I saw elsewhere).

  7. Re:Warning: Windows 10 is draining your battery on Windows 10 Warns Chrome and Firefox Users About Battery Drain, Recommends Switching To Edge (venturebeat.com) · · Score: 1

    Warning: Windows 10 is draining your battery by being a poorly conceived and implemented operating system. You should install Linux immediately.

    Actually, due to what I think is a gtk3/glib3 bug, firefox regularly spins up the CPU, heating up the machine to the point it burns my lap, as well as making firefox perform poorly, for extended periods of time. Have also noticed it in other applications, such as Eclipse based applications (Lotus Notes for my sins) but it makes my Ubuntu installations very battery hostile.

  8. Does UK enjoy the same amount of Freedom that America has?

    Not even close!

    ***AMERICA!***

    Significantly more when you look at the details.

    How so? If the local government wants to censor you in a European country, they just have to label what you said as hate speech, regardless of whether or not it actually is. For example, it's illegal to collect WWII memorabilia in Germany, because it's considered "hateful" to do so, along with walking in any manner resembling a goose step.

    All the goose-stepping, WWII collecting Americans must be loving this thread....

    In the US meanwhile, so long as you aren't calling for somebody to be physically injured or killed, you can do or say whatever you want without fear of adverse government action against you.

    You must be so proud

    Let's also not get into the fact that pretty much everywhere you go in a populated area, your actions are likely being recorded on camera, and you have no right to defend yourself in the event of a home invasion.

    I'm not aware of a single CCTV camera within a 1 mile radius of my home. Plenty of council ones in the town centre, but not in the wider suburbia.

    Oh, and how's that mass surveillance working out for you?

    In the UK, at least, you can use "reasonable force" to defend yourself. But it's true, I can't use disproportionate force, like shooting someone dead for wanting to steal my TV. We grew out of that in the early 19th century.

  9. Re:DRM the poem on Chrome Bug Makes It Easy To Download Movies From Netflix and Amazon Prime · · Score: 1

    It means that DRM has unfixable weaknesses, because part of the path cannot be encrypted.

    It can, but it just wouldn't make for good viewing.

  10. Clean install on Ask Slashdot: Would You Recommend Updating To Windows 10? · · Score: 1

    I actually like Win10 (privacy/telemetry issues aside), and it's the first MS OS I've actually been (mostly) impressed with since NT 3.51 (which was solid as a rock.)

    But the main reason I would want to upgrade any machine I can is that once installed and activated, you can re-install Windows with the download ISO image from Microsoft. That means you can take a crapware laden OEM piece of shit, upgrade to Windows 10, wipe it and reinstall a virgin Windows 10 with no further activation issues, no OEM crapware.

  11. So you'll be biddling twits all day instead?

    You messed it up. It goes like this: if binary digits are bits, ternary digits must be tits. Twiddling tits. That's what he'll be doing.

    Is this a bad time to mention hard disks?

  12. Re:Famous last words... on Jail Sentence For Popular YouTube Pranksters (bbc.com) · · Score: 2, Informative

    How do you "prank" a theft from a portrait gallery? If they actually stole a portrait, then it's theft. It doesn't matter if they give it back and say "it's just a prank".

    Actually, it does. From the Theft Act 1968:

    "A person is guilty of theft, if he dishonestly appropriates property belonging to another with the intention of permanently depriving the other of it"

    Therefore, with no intention to permanently deprive someone of the object, no theft has taken place.

    From TFA though:

    "All four pleaded guilty to two counts of using threatening, abusive, or insulting words or behaviour with intent to cause fear of, or provoke unlawful violence for their involvement in the two hoaxes."

    Bloody hell, half of the MPs in the country could be done for that if they didn't hide behind their parliamentary privilege. The above words could be easily applied to the Brexit referendum FUD being spouted on both sides.

  13. Re:Reassuring on UK Man Faces Prison For Circumventing UK's Pirate Site Blockade (torrentfreak.com) · · Score: 3, Informative

    I'm glad to know that given all the cuts on the police force that Osborne is talking about, the humming a tune in the shower police unit remains well-staffed. Right along the lines of the "Big Society" trumpeted by Cameron.

    After all, who cares about assault, burglary, etc ? Good luck having the police respond to a call reporting assault. Good citizens should band together and defend against those, the police is too busy with much more serious crimes. Like not paying for the right to hum a tune in the shower.

    Last time I was assaulted in the street, the next police officer I flagged down was more concerned that I happened to be inadvertently spitting blood in his face.

  14. Similar to tax dodging on UK Man Faces Prison For Circumventing UK's Pirate Site Blockade (torrentfreak.com) · · Score: 1, Insightful

    This appears to be a "spirit of the law" sort of case. While nothing he has done is in itself criminal (he's laundered no money, and personally committed no fraud) he has assisted others in potentially performing now criminal acts.

    So how is this any different to myriad of tax evasion schemes, which also fly in the face of the "spirit of the law"? I'd rather the powers that be concentrate on the (IMO) fraudulent actions of large (and small) corporations denying the people of this country reasonable tax income.

  15. Re:Can I run CyanogenMod on my PC? on CyanogenMod 13.0 Release 1 Released (androidpolice.com) · · Score: 1

    My problem, and most people's I believe is needing to physically upgrade the smartphone all the time (i.e. buying a new phone). Right now I have a 4.0.4 Android one and need to run an app (for work!) which requires 4.1. My otherwise excellent phone would be made obsolete by a .1 release. I also consider the problem of using too many "conflict" resources because of increasingly frequent purchases -- not to mention it's painful to pay the same amount on a smartphone and on a Linux notebook. What do we do with all the older hardware we accumulate? These are limited machines with no hard disk, little RAM, a moderate CPU (probably as powerful as Pentium III), but they cost me an arm and a leg in the past...

    I find upgrading old phones an interesting exercise, and have learned much in the process. if you don't mind risking your phone to an upgrade, I'd recommend doing it (if supported) just for the mental exercise, let alone the practical benefits having a newer stock of software brings (performance, security, features, etc.)

    As to uses for old phones? As a plaything for experimenting with later custom Android roms? Use the camera as a CCTV device? Donation to someone who might not have a smart phone?

  16. Re:I still have me BBC on One Million School Children To Get Free BBC Micro:bit Computers · · Score: 1

    Way to split hairs. Compiler, interpreter, a way to create your own programs. Computers don't come with them and haven't for quite a while.

    Depends on what you consider as ways to create your own programs.

    MacOS X comes with a programmable shell.

    Any other Unix[like] OS also comes with at least a shell. Linux and BSDs generally come with a full programming env on the install media.

    Any Open Firmware based computer has an entire forth programming environment built into the firmware.

  17. Re:Interesting idea on Why Buses Need To Be More Dangerous · · Score: 1

    Never going to happen though. Once someone as much as mentions a potential risk, the result with the current culture is an overreaction to avoid it.

    Already a thing in London: New Routemaster

    Has a hop on-off deck so people can jump on while the bus is stopped at lights, for example.

  18. Re:Can I run CyanogenMod on my PC? on CyanogenMod 13.0 Release 1 Released (androidpolice.com) · · Score: 4, Informative

    Since he asked let me add a question myself: now that CyanogenMod is in bedsheets with M$....

    CyanogenMod isn't in bed with Microsoft. You're thinking of Cyanogen Inc., which commercializes CyanogenMod and includes MS services, but CyanogemMod doesn't align with any single provider, and can be used with Google, Amazon or FDroid app stores, or no app store at all.

    citation

    BTW. I actually find the Microsoft Arrow Launcher quite good.

  19. Re: When will people learn? on Raspberry Pi 3 Is a Nice Upgrade, But Alternatives Exist With Faster Performance (phoronix.com) · · Score: 1

    I wanted an internet connected device that gets regular security updates with a screen smaller than 5in. Any good Android devices fit the bill?

    Any suitable phone supported by Cyanogenmod? My HTC One S is fantastic, cost me £50 on ebay, and runs CM-12.1 (Android 5.1) like a trooper.

  20. Re:When will people learn? on Raspberry Pi 3 Is a Nice Upgrade, But Alternatives Exist With Faster Performance (phoronix.com) · · Score: 3, Insightful

    Computers like the Raspberry PI are great for start-up companies who can't afford to go to a manufacturer and have their own custom electronics made

    Hi, hardware startup guy here. I'm going to come out and say that tautologically, if you know what you're doing, then doing custom hardware yourself is actually not nearly as difficult as you think.

    First board design is cheap and easy. ...

    ... for a hardware startup guy.

    For the rest of us, who may not have hardware or electronics experience but want to sell a solution, just buy $5 Pi Zero boards.

  21. Re:Ethernet on Raspberry Pi 3 Rolls Out With Faster CPU, On-Board Wi-Fi, and Bluetooth · · Score: 1

    I'm thinking the same. If all they had changed was USB 3 and Gig Ethernet I would be buying to replace the old. Even with it still being limited to 1 root USB port would be 10x improvement. (480MPs vs 640MBbs)

    Even better would have been Ethernet not going through the usb, more multiple usb root ports. (or the ability to add on higher speed devices like SATA/eSATA/Firewire/More USB 3.x ports )

    *sigh* Maybe there will be another revision with it, or next release . . . .

    The SoC used pretty much outputs only USB, HDMI and GPIO. There is no PCIe controller built in, the memory accesses (used for CPU and GPU) go straight to memory mounted on the SoC. The SoC is just not designed for other IO options, and why should it? It's basically a set top box SoC by design, and that's pretty much how most people use it.

    Moving to another fundamentally different SoC would probably have compatibility issues.

  22. Re:Ethernet on Raspberry Pi 3 Rolls Out With Faster CPU, On-Board Wi-Fi, and Bluetooth · · Score: 4, Insightful

    But still the same ethernet that goes over the USB bus?

    And? A 100Mbps ethernet interface is fine over the 480 Mbps USB2 bus. You're not going to be running an enterprise NAS on this thing now, are you?

    The original USB ethernet had problems with the poly-fuses blowing out under load. That's not a problem now with later Pis.

  23. Re:Nuclear Power on US Asks VW For Electric Cars (news.com.au) · · Score: 1

    I'm still not buying one until I can swap out the batteries with a nuclear reactor.
    Alert: Low Fuel: 1,000,000,000 miles before empty.

    Nah. Just the ability to swap the batteries at the "filling station" would be good enough. A 200 mile range is no problem if all you have to do is a 5 minute battery change.

  24. Re:Nuclear Power on US Asks VW For Electric Cars (news.com.au) · · Score: 1

    The risk of uncontrollable meltdowns is what killed the fusion car. It was in the design phase at some point, but never built due to concerns regarding collisions.

    That, and the fact we don't even have static fusion power yet.

  25. Re:VW has lost trust, needs fines and free softwar on US Asks VW For Electric Cars (news.com.au) · · Score: 1

    ..., and every country should be requiring complete corresponding source code under a free software license from VW and any other automaker that lied, sold equipment under false pretense, or dodged environmental regulation.

    Except the "source code" is usually the property of the ECU maker, not the car maker. The car maker provides only data input and tables to the ECU, which then acts accordingly.