Hacker News new | past | comments | ask | show | jobs | submit | dcvuob's comments login

Second example is very readable using Allman style:

    if( condition_a )
    {
         if( condition_b )
         {
             do_thing_a();
         } 
         else 
         {
             do_thing_b();
         }
    } 
    else 
    {
         do_something_else();
    }
Editor space is free, why not use it.


Horizontal space is free, vertical space is not.

The more lines that are visible on your screen, the less you have to keep in your working memory. Human memory is fragile, so you really don't want to rely on it.

I can only fit 51 lines vertically (damn widescreen laptop) so that one snippet fills a good 1/3 of my screen.

Personally I'd write that as

    if (condition_a) {
        if (condition_b) do_thing_a();
        else do_thing_b();
    }
    else {
        do_something_else();
    }


The more lines that are visible on your screen, the less you have to keep in your working memory.

Sure if you only saw a few lines at a time, then this might be a problem. But you can see 51 on a laptop. This is enough for almost all cases. And you can scroll if you need to look up something. If you stumble upon a case of multiple if statement that span several screens then no style is going to help you see it in full. In that rare case you might see a little more, at the expense of all code ever becoming less readable (if we assume Allman is more readable for the sake of this argument of course).

If for some reason your code has more than, let's say >50% cases where something spans multiple screens and needs to be seen as a whole (code which should be refactored, but let's ignore that), then you might have an argument to use your style, in all other cases you're doing premature optimization of your coding style, so to speak.


Those if statement should be written using the ternary operator. In my subjective opinion, putting the expression in the same line as the if statement is awful. Objectively it is worse because you create a possibility of certain types of errors, like a hanging statement or similar. Ternary operator doesn't have those.

The second example is missing error checking. So the real code isn't that nice.

My point is that C shouldn't look like Python. Small amount of functionality should be written unambiguously and take a lot of space if necessary. Because of the nature of C, it needs a lot boilerplate, and will take a lot of screen space anyway, but that is not a problem, as we are not coding on paper.


It would be really nice if instead of downvoting, someone could provide a counterargument, or comment on parts the disagree.


I downvoted it to indicate that I don't agree with your preference. I rarely downvote for disagreement, but this was a case where I thought it worthwhile to offer the feedback that others strongly do not share your view. My equally strongly felt subjective personal belief is that single line if statements without braces are fine, but that once a second line is required braces should be mandatory.

I find the single line "if" statement without braces to be clearer and simpler than ternary with a (void) expression, and don't think the downsides are significant. It breaks if you were to add another statement after the semicolon on the same line, but I think that should almost always be avoided anyway.

I do find it interesting that others prefer two-line without braces over the single line approach. I find this one to be more dangerous than the single line. Possibly because with line-oriented debuggers it can be hard to set the right breakpoint?

It's quite possible that others are downvoting because they think you are trolling, and that no one would actually believe the ternary operator to be clearer. I wondered also about your defense of Allman braces, which I didn't downvote because I think it's a good example of how different the others's views can be on what seems obvious. While I think (some of) your views are in the (very small) minority, please keep posting them!


How would you use the ternary operator there? Like this?

    image ? foo_release(image) : 0;


Yes. And cast that 0 to (void), so the compiler won't complain over an unused expression.

Any C programmer will recognize what (void)0 means, do nothing.


Sure, but I find it strange to use the ternary operator and discarding the value. It's not wrong, but I think most C programmers prefer a simple if statement.


I was giving an replacement for the if statement presented above, where both expressions are on the same line.


I'm closing in on year 25 of programming in c, and I still refuse to use the ternary operator.


Terrorists cannot be innocent. /s


If only Twitter joined them.


They were the first to show strong support: https://twitter.com/jack/status/700457149227360256


It's rare but it does exist: https://en.wikipedia.org/wiki/Kim_Peek


You'd have to find an MP with that same ability.


While it is unlikely that a natural eidetic currently serves in parliament, memory is something that can be trained and improved.

So you take a willing MP, teach them about mnemonics, memory palaces, chunking, and list-ordering narratives, and you could likely smuggle out a few dozen pages every week.


Welcome to the future (of 2013): https://youtu.be/8SkdfdXWYaI?t=9m5s https://youtu.be/8SkdfdXWYaI?t=16m22s

Don't forget to see the entire talk (28 minutes): https://www.youtube.com/watch?v=8SkdfdXWYaI


One important note is that your throat gets tired talking, just like your hands do typing.


I think it is an issue of convenience. Anecdotal evidence, I have never had trouble doing either of those for 8 hours straight (and more).

Voice will need some serious software support if it is going to take off. There is zero chance that users will learn those mnemonics, just as now almost nobody knows how to touch type. The usage will be more in the form of general commands, than specifying every action like we do it now with the keyboard+mouse.


The pdf is discussing vehicles, specifically aircraft, that would utilize LENR assuming it works.

Here is an excerpt from the pdf: This report does not explore the feasibility of LENR. Instead, it assumes that a working system is available.

Your statement: there are folks at NASA and SPAWAR that think LENR (not fusion per se) is real., is incorrect, they assume it works for the purposes of the discussion about aircraft.

You are either scamming or are being scammed. In the latter case (and I'm trying to help you here), please make an effort with some serious research and re-evalaute your opinions.


"The pdf is discussing vehicles, specifically aircraft, that would utilize LENR assuming it works. Here is an excerpt from the pdf: This report does not explore the feasibility of LENR. Instead, it assumes that a working system is available."

Correct, however it is referring to a functioning, practical reactor, not the underlying phenomenon. The statement I made: "First off, there are folks at NASA and SPAWAR that think LENR (not fusion per se) is real" is entirely accurate.

More than that, there is substantial, rigorous scientific evidence that LENR is real.

===========================================================

From the SPAWAR materials:

Experimental Results Since 1989

– Excess Heat >> chemistry (F&P, SRI, CL, Bockris, Storms, Energetics, ENEA, Miley, Swartz)

– 4He, commensurate with excess heat (SRI, China Lake (CL), ENEA)

– Low intensity, soft X-rays (0.5-20 kev), (SRI, CL, SPAWAR, Karabut)

– Tritium Production; a species of nuclear ash (BARC, Bockris, Storms, Claytor, SPAWAR, SRI)

– CR-39 tracks suggest MeV neutron emission. (SPAWAR, BARC, Takahashi, Jones, Mizuno)

– Many nuclear transmutations, ΔZ = +2, +4, +6 (MHI, Mizuno, Bockris, Dash, SPAWAR)

– Sensitivity to radio freq & near IR stimulation (Bockris, Letts/Hagelstein, NRL).

– Emission of strong RF signals near 85 GHz (ENEA) and 1-5 MHz (NRL).

From the NASA materials (slide 5):

Current LENR Technology (LENR reactor 12/12 and 3/13 respectively):

- Energy Produced (Wh): 62,000 / 160,000

- Power Density (W/Kg): 530,000 / 7,000

- Thermal Energy Density (Wh/kg): 61,000,000 / 680,000

- Reaction mass: 1g / 1g

- Test duration (h): 96 / 116

- Max. Temp. (deg C): 496 / 308

===========================================================

Those results could only be from nuclear phenomena - chemistry is entirely unable to explain the power output, transmutations, and radiation.

Links:

https://www.lenr-forum.com/forum/index.php/Attachment/386-IE... https://connect.arc.nasa.gov/p1zygzm2h3i/?launcher=false&fcs...

Get a clue - I'm trying to help you here.


If you want to help, maybe don't tell people to "get a clue," because that just turns them against you, and also read what your sources are actually saying.

It doesn't matter whether the paper you linked is discussing the phenomenon in general or a specific device. The fact remains that it is clearly a hypothetical exercise in which it assumes that the device works, and sees how it could be used if that were the case. That doesn't mean they think the device actually works, only that there's enough potential to have a few people think about it for a little while.

Same deal with the NASA presentation you posted in this comment. From the Objective slide: "Explore the application of LENR technology not the technical aspects and feasibility." "Assumed device existed with these parameters." It's a hypothetical exercise. Nothing here supports your assertion that NASA thinks this is real.

In any case, my main point remains: why hasn't anyone done the obvious test to prove that this device is real? We're not talking about some delicate scientific experiment producing subtle mysterious phenomena. We're talking about a concrete physical device which the creators claim is a megawatt nuclear reactor. Isolate it and make it produce power and prove beyond all reasonable doubt that it does what it says. Why is that so hard?


"In any case, my main point remains: why hasn't anyone done the obvious test to prove that this device is real? We're not talking about some delicate scientific experiment producing subtle mysterious phenomena. We're talking about a concrete physical device which the creators claim is a megawatt nuclear reactor. Isolate it and make it produce power and prove beyond all reasonable doubt that it does what it says. Why is that so hard?"

BTW, to this point:

In the information I linked was data from the 12/12 LENR NASA run which produced 62 KWh of excess energy over the course of a 96 hour run - using one gram of material.

That is entirely consistent with LENR, and utterly inconsistent with any chemical explanation. It was observed under rigorous experimental conditions by NASA research scientists.


Can you tell me where to find the original information about this 12/12 LENR NASA run? I must not know what search terms to use.

Edit: to be clear, I'm wondering what the experimental setup was. What sort of device were they testing, how were inputs and outputs measured, etc. Not just the results, but the experiment from which they got those results.


Well it appears I get to eat a little crow. It was not NASA work, but it was a peer-reviewed paper cited in the NASA materials:

http://arxiv.org/abs/1305.3913

The NASA material is worth reviewing in its own right though - and the Navy has conducted quite a few LENR experiments of its own.


I find this paper to be extremely confusing.

They state that they couldn't weigh the device because it was already running when the test began. Why would they start it before doing basic tasks like seeing how much it weighs?

Oh, because the test was conducted at the company that makes the devices, and I guess the company set up the device and turned it on before the scientists got there.

Then one naturally wonders, who set up the equipment to monitor the electrical power consumed by this device? As far as I see, the paper does not say.

One further wonders, why does it need a continuous input of electrical power at all, if that power is only connected to resistor coils in the device as claimed? The paper says that electric heat is needed to start the reaction, but why doesn't the reaction sustain itself on its own heat after starting? Why can't they just unplug the thing at that point?

Finally, the experiment was conducted with the device sitting out in the open, radiating and convecting into the air. Output power was estimated by pointing an IR camera at it (measuring only half of it!) and calculating power based on the observed temperature. All of this in an environment controlled by the company that makes the device.

I hope you can see how this experiment is 1) nothing like the definitive test I describe and 2) suspicious as all hell.

The test I describe is not difficult to set up and would not be difficult for a real, working device to pass. So again, why don't they do it? That they don't doesn't automatically mean it's a scam, but then what is the answer?


First off, the "get a clue" remark was a response to the assertion that I was scamming or being scammed (i.e. clueless) - as well as the generally condescending tone.

The main controversy around LENR has been whether or not there's a real phenomenon. Clearly there is. Given the experimental results so far, as well as Rossi's work, it seems pretty clear to me there'll be practical reactors in the future if there aren't already. The first principles need to be better understood for best results.

Time will tell, eh?


That is an disingenuous representation of how the attacks works. That attacks OPSEC, not the Bitlocker itself. Any full-disk encryption is "vulnerable", to this kind of attack.

The page even explains this:

https://github.com/carmaa/inception#awesome-but-why

https://github.com/carmaa/inception#unlock


Not really. Full disk encryption using Pointsec/other commercial offerings, or as you typically do it on Linux with LUKS+dmcrypt, asks for the passphrase before the OS has loaded any Firewire drivers. In which case a fully shut-down computer is not vulnerable to this attack, ie. you have protection against evil maids, thieves, FBI etc.

But with Bitlocker, it only requires a password at Windows login, and by then all the Firewire etc. drivers are up and running. So you have no protection for computers that are stolen/seized by law enforcement.


IIRC BitLocker with pre-boot authentication mitigates DMA attacks. Most Windows hardware doesn't come with FireWire or Thunderbolt ports nowadays. Microsoft recommends pre-boot auth for devices with DMA ports.


These are fair points. But for businesses in particular, it's a problem since many skip on (or are unaware of the need for) pre-boot auth, and business laptops still pack FW ports, if not on the laptop itself, then surely on the docking station.


Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: