Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror

Comment: Re:Answer (Score 1) 282

by lgw (#49788439) Attached to: How Much C++ Should You Know For an Entry-Level C++ Job?

init() should only ever be a thing where you need to perform some kind of init after construction.

Indeed. Should. No argument there. But half the C++ code I've ever worked on was terrified of the scary exceptions, and so wouldn't do anything useful in constructors, since that might throw, and would instead do all the work in init() so that a #defined error code could be returned (which then this caller would forget to check every so often, leading to fun bugs at some spot quite distant in code from the error).

Comment: Re:Answer (Score 1) 282

by lgw (#49788405) Attached to: How Much C++ Should You Know For an Entry-Level C++ Job?

Well, true enough, I haven't looked at anything Google in about 5 years. I exaggerate about caring that much about the style guide - the truth it, Google is a despicable, evil company, and while I might work there to avoid starving, that's only because I'm weak.

But fuck using * for out params with a cactus soaked in Tobasco sauce. The return value of the function is for returning values, which you can do if you do waste it because you're scared of the terrible exception-monster in the closet (and for multiple return values, a non-const reference is non-const). And fuck only having trivial constructors, because, you can't throw exceptions, so you can't do RAII. The 80s had fun music, but the coding style of the 80s needs to go away.

Comment: Re:a microscopic black hole won't hurt you (Score 1) 135

by lgw (#49787739) Attached to: Prospects and Limits For the LHC's Capabilities To Test String Theory

I know the "proton-sized black hole with a positive charge" with an electron orbiting it has been studied - but I don't know what was concluded. But you won't get "orbits" out to maybe 3x the radius of a black hole, so no danger of that for the Everest hole.

The LHC uses two beams colliding from opposite directions, so the total momentum of a collision is low. If most of the energy of collision goes into making the black hole, then the mass of the black hole would be much higher than whatever collided, and thus it's velocity would be much lower than the difference in momentum of those two particles.

Comment: Re:Disappointing (Score 1) 92

by lgw (#49786335) Attached to: Microsoft Edge To Support Dolby Audio

TrueHD needs to die in a fire. DTS is CD-quality audio, while TrueHD and DTS HD-MA are just a waste of space. The latter is always mastered such that you can trivially rip the DTS track when you're ripping the DVD, but TrueHD leaves you with just the AAC track if you don't want to double the size of your rip. TrueHD is a copy-protection measure, nothing more.

Comment: Re:I'm not the target audience apparently (Score 2) 92

by lgw (#49786297) Attached to: Microsoft Edge To Support Dolby Audio

Hey, I have been married for more than 20 years and have two children and I'm on slashdot.... He/She can have a girlfriend...

No, no, /.ers can totally be "married for several years", or have no girlfriend at all - either way you're not getting laid. It's that in-between zone that we don't see here. (There's an old joke: put a pebble in a jar every time you have sex until your first anniversary. Remove a pebble from the jar every time you have sex after that. The jar will never be empty.)

Comment: Re:Answer (Score 1) 282

by lgw (#49786207) Attached to: How Much C++ Should You Know For an Entry-Level C++ Job?

Yeah, I've done that trick before: it's not quite the same. It's been a while since I tried, but I remember it not working for some operators and implicit conversion the way it would with a simple public data member - complexities of type inference.

There was actually a provision for this originally, sort of: by overloading the -> operator you can change what foo->bar returns, but you can't change what foo.bar returns, and since I almost never pass pointers around I rarely use the -> operator

Comment: Re:a microscopic black hole won't hurt you (Score 1) 135

by lgw (#49786027) Attached to: Prospects and Limits For the LHC's Capabilities To Test String Theory

It says that a 3K black hole has a mass of 4x10^22 kg, a bit larger than the Everest-sized black hole.

The moon is just over 7x10^22 kg.

m not quite sure how to solve for one that would be hot enough to suck in the earth before evaporating

The hard part is determining the rate at which a small black hole would consume matter. Very small black holes simply don't have the cross-section to consume matter fast enough to live. The hole would have to live long enough (and still have a cross-section large enough) for the few seconds needed to fall through the ground and get deep enough to pass the water table and into denser crust. From that point it's a matter of its cross-section, speed, and the density of the rock its passing through.

My best estimate for the Mt Everest mass is 4*10^15 kg, which gives a radius of 6 pm - seems big enough to eat silicon and iron atoms.

Comment: Re:a microscopic black hole won't hurt you (Score 1) 135

by lgw (#49785515) Attached to: Prospects and Limits For the LHC's Capabilities To Test String Theory

I propose we adopt "mass of Mt Everest" as a new Slashdot standard of measument - measuring mass in Libraries of Congress was always awkward.

I believe the mass of Mt Everest estimate is correct for the Earth-destroying black hole - it's the point at which matter infall at the density of the Earth's interior exceeds Hawking radiation. In a vacuum, the magic mass is about the mass of the moon - the point at which the Hawking radiation is cooler than the CMBR, and so you won't have a net loss for 10^lots years.

Comment: Re:Answer (Score 3, Insightful) 282

by lgw (#49785289) Attached to: How Much C++ Should You Know For an Entry-Level C++ Job?

(You can't "compile with RAII turned off", as RAII is a coding style: you're probably thinking of RTTI. But the RAII style might not be good for a realtime system, as it can hide expensive work to release resources.)

The abomination that is Google's C++ coding conventions is why I hang up on their recruiters. (Though I hear an internal war has been raging for a couple years within Google over their 80s-night coding conventions). Actually, I'm not sure what's you'd use from C++ beyond "C with classes" if you're writing C-style code. If you're not comfortable with exceptions, and are following an "allocate at the top, clean up at the bottom, never return from the middle" mindset, C++ is damned awkward - you won't be using the standard libraries much, you won't have non-trivial constructors, and so on.

Comment: Re:Answer (Score 2) 282

by lgw (#49785195) Attached to: How Much C++ Should You Know For an Entry-Level C++ Job?

Oh fuck yes. But that's easy to explain to a new-hire - it's just a tedious convention, not really a mindset thing. IMO, the single most annoying flaw in C++ was not making all members and parameters "const&" by default. (Passing an int by value instead of by const reference is just the optimizers business, not a semantic change). I'd much rather declare the non-const exceptions!

And while I'm wishing, C++ really needs C#-style properties - a way to optionally intercept "foo.bar = 4" to add a non-trivial setter, without cluttering code with getBar() and setBar() functions "just in case".

Invest in physics -- own a piece of Dirac!

Working...