Live data from Hacker News

Linus Torvalds on aliasing

yodaiken.com

31–40 of 284 posts

Re: Linus Torvalds on aliasing

#34
To me, this rant seems more directed at C standards people than the guy he sent it to. That doesn't excuse his vitriol, but I hope people will read between the lines.

Sometimes people forget that C was created for writing operating systems. They get in their mind that C is all about high-performance, and that making it competitive with FORTRAN is the way to go. I understand that, but it's not what C was created for. If the world's most famous C programmer and OS guru wants to have strong opinions on the direction of the language, I say allow it.

Re: Linus Torvalds on aliasing

#35
I'm in no way offended by Torvalds' typical expletive-laden rants. But they do strike me as a terrible way to communicate.

These outbursts seem to happen every few weeks, and have long seized to surprise. IF anything actually bad ever comes up, he has no further escalation available to raise awareness.

It also reminds me of these choleric bosses screaming at someone every day: it's almost always a sign that they're insecure, sociopaths, or can't handle their responsibilities.

Re: Linus Torvalds on aliasing

#36
Linus Torvals says something technical and full of insights while keeping control over emotions - crickets nobody cares.

Linus Torvals adds some insults into the above or simple does not even attempts to keep control over his emotional side - half people jump up and down happy like a fourteen years old. Wow, look, he used insult! The other half suddenly turns into prude "I never swear nor insult anyone" Victorian aristocrats - despite having tweet feeds full of, and I am quoting here, "fucks".

Re: Linus Torvalds on aliasing

#37
post #32

Can someone ELI5 what the issue is with type punning and union aliasing?

Suppose you want to look at the bits of a floating point number, as though it were an integer. The type punning way to do that would be to access a double in memory through an integer pointer:

    double d = 3.14;
    int64_t *p = (int64_t *) &d; // !!!
    int64_t n = *p;
The union aliasing way would be to makeset the double field in a union and read the integer field back:

    typedef union {
        double d;
        int64_t n;
    } int_or_double;

    int_or_double u;
    u.d = 3.14
    int64_t n = u.n
According to the standard, the union aliasing approach is allowed, but the type punning one is undefined behavior.

---------

The standard team decided to forbid type punning to allow compilers to implement more optimizations. They still allow union aliasing because they felt there should still be a way to do low-level type casts if for those that absolutely want to.

Re: Linus Torvalds on aliasing

#38

I never really understood why people complain about Linus personality. If you don't like it go somewhere else nobody is forcing you to code for Linux. Fork it and make your own.

Right, but why does an adult have to behave like a spoiled little princess anyway?

Re: Linus Torvalds on aliasing

#39
post #32

Can someone ELI5 what the issue is with type punning and union aliasing?

Several compiler optimizations center around proving which variables don't change. Allowing type punning makes it harder for the compiler to do this.

Re: Linus Torvalds on aliasing

#40

I never really understood why people complain about Linus personality. If you don't like it go somewhere else nobody is forcing you to code for Linux. Fork it and make your own.

> Fork it and make your own

Even Google couldn't pull that off with Android.

Post reply on HN