Better HN
topnewbestaskshowjobs
Log inSign up

dsfuoi

91 karma · joined Apr 14, 2016 (10y ago) · 57 submissions

Submissions

comment 10y ago · link · parent

programmers use int to index over arrays in for loops without writing asserts. That is in fact a problem with the language.

Ok let me get this clear, you're saying that the language is at fault because the programmers don't write correct code. I have no words.

comment 10y ago · link · parent

If the loops can be written and the programmers don't write them, the problem is with the language!?

No, it's pretty clear where the problem is with C, programmers.

comment 10y ago · link · parent

It looks easy but it isn't.

The second example causes unexpected behavior (and probably ub later) if: min + step > MIN_TYPE_MAX

The last example causes undefined behavior if: max - min < step - 1.

comment 10y ago · link · parent

It's just one line. Put this before the loop if the code logically shouldn't trigger this.

  assert( B < B_TYPE_MAX - 4 );
Or use an if statement if it could trigger at runtime.

Also the code is clearer on intent.

comment 10y ago · link · parent

In terms of sociologic development the middle-eastern countries are considered backwards with their stone-age laws, ingrained religion, and treating women like lesser beings, and yet we may soon be wearing 'burka' like clothing to protects our identity. Of course apart from the physical look, there is no connection between the two.

comment 10y ago · link · parent

For the scramble suit to work, publicly available 'mixing' stations would have to be available, which would work like a black box, you could only surveil input and output.

And exits from your house would have to somehow be connected to those stations, or have your house change locations randomly.

The latter could work if houses were mostly in form of larger modular worldwide-compatible shipping containers. Also no windows, we would have VR.

comment 10y ago · link · parent

Maybe we are the primitive ones.

comment 10y ago · link · parent

Correct me if I'm wrong, but in this scale model, I think the part of the building marked with a black rectangle (upper left) is what is currently being built.

https://www.bloomberg.com/features/2016-inside-tesla-gigafac...

comment 10y ago · link · parent

It certainly could be, but I think most mistakes are made because of how the process is 'designed'; sometimes an incorrect molecule jiggles (literaly) into a place where it is improbable that it should.

comment 10y ago · link · parent

So only about 4Gs? I somehow though it would be more and unsurvivable for humans.

comment 10y ago · link · parent

I would say that ionizing radiation isn't the cause of most genetic mutations. It is just too rare and most of it doesn't penetrate the skin anyway, the rest has to be really lucky to hit the cell in the right place at the right time.

DNA copying not being perfect would be the main cause in my opinion.

There is one error on average for every billion pairs copied. The human DNA has 3 billion pairs. So every time a single(!) cell is copied, three mistakes are made.

You don't need any radiation for evolution.

comment 10y ago · link · parent

I still haven't seen anyone write what those fraudulent acts are exactly. Since Craig Wright (let's not call him what he isn't) apparently has several companies, these should be some clue about that?

comment 10y ago · link · parent

It feels like a rage quit. Completely frustrated when you simply cannot win, there is only one option remaining. Anger and self-pity.

comment 10y ago · link · parent

You don't know if he is a sad, broken man.

There is no evidence to believe the post reflects upon his real emotions, and since the man is untrustworthy[0], the post cannot be taken as evidence about his emotional state.

[0]:Whether he is willfully or maliciously deceptive is irrelevant. Even if he has the best of intentions, his behavior is still untrustworthy.

comment 10y ago · link · parent

Replay at 16x speed if you're busy: https://youtu.be/89AIsPTCJLs?t=10m35s

comment 10y ago · link · parent

That is a promo.

Here is an actual simulation: https://www.youtube.com/watch?v=89AIsPTCJLs

comment 10y ago · link · parent

So, will I have to login into something to read the docs now?

comment 10y ago · link · parent

Running an ICE car in a garage will harm you (and kill you pretty quickly), running an electric car will heal you.

It sounds cheesy but it true.

comment 10y ago · link · parent

Choose carefully, one of those deploys the ejection seat.

comment 10y ago · link · parent

I agree. The problem is that those single character names get abused and you end up with code that consists only of them, including the function arguments, which is the worst.

comment 10y ago · link · parent

The 'style' even leaked out to file naming: a.c, ab.c, af.c, am.c, c.c, ca.c, cc.c, cd.c, cf.c, ...

Brilliant!

I doubt that this is either serious (unobfuscated) or handwritten code though.

comment 10y ago · link · parent

I agree, and I have calculated this a while ago this based on average number of lines a programmer writes in 8 hours. I don't have the actual numbers but unless you type slower than ~30 words per minute, speed it isn't a bottleneck.

I have been using index instead of i in while loops lately. It's surprisingly concise.

comment 10y ago · link · parent

Why are you learning it?

comment 10y ago · link · parent

Fabien is hinting at the confusion: sizeof(&array[0]) != sizeof(array)

&array[0] and array decay to the same thing, the pointer to the first element if they are used in an expression. But sizeof gives a different result, because array+0 'decays' to a pointer, and array doesn't.

comment 10y ago · link · parent

I think the style should be avoided; code shouldn't be compact and variable names should be descriptive.

Artificial example:

    for( int i = 0 ; i < c+j ; i += b )
should be:

    for( int count = 0 ; count < sum+extra ; count += skip )
It may be allowed to use i in place of count here, but this is the only place where single name variables should be permitted and only if i is really just a simple array index iterator.

comment 10y ago · link · parent

This is the first time I have seen sizeof used like this:

  sizeof( &array[0] )
This looks equal to:

  sizeof( array )
at first glance, which would give the size of the entire array in bytes, but of course the &array[0] expression is really:

  &*( array + 0 )
which simplifies to:

  array + 0 
which is a pointer. And using sizeof on it gives the size of a pointer to int.

Edit: (&* array) will also give a pointer.

---

This is just a really convoluted way to write 2:

   &array[2] - &array[0]

   &*(array+2) - &*(array+0)

   (array+2) - (array+0)

   2 - 0
Again I have never seen this written in such fashion.
12