Live data from Hacker News

Linus Torvalds on aliasing

yodaiken.com

201–210 of 284 posts

Re: Linus Torvalds on aliasing

#201
post #68
post #37

Earlier quoted context omitted.

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;…

AFAIK even using union for the above purpose can be seen as "undefined behavior" when reading standard, and that's why the standard is especially wrong, as it makes some typical desired (and needed) outcomes impossible to implement, and at the moment clang still has problems even with the union variant whereas gcc allows you to use union by passing the compiler switch which effectively has the semantics "we promise w…

What part of the standard should I read to come to the conclusion that type punning with unions is undefined behavior? C99 and C11 both explicitly mention that it's not, but maybe you're talking C89/C90?

IMO there are 4 highly relevant paragraphs in C99:

6.2.6.1: When a value is stored in an object of structure or union type, including in a member object, the bytes of the object representation that correspond to any padding bytes take unspecified values.

6.2.6.1: When a value is stored in a member of an object of union type, the bytes of the object representation that do not correspond to that member but do correspond to other members take unspecified values

6.5.2.3 DR283) If the member used to access the contents of a union object is not the same as the member last used to store a value in the object, the appropriate part of the object representation of the value is reinterpreted as an object representation in the new type as described in 6.2.6 (a process sometimes called "type punning").

6.7.2.1: A pointer to a union object, suitably converted, points to each of its members (or if a member is a bit-field, then to the unit in which it resides), and vice versa.

None of this implies that unions can't be used for type punning. What it does imply is that reading from a larger member of the union than you last wrote to will leave you with an unspecified value.

Re: Linus Torvalds on aliasing

#202

Earlier quoted context omitted.

My wife works in mental health, dealing with people at the very lowest ebb. You'd think the therapists' internal meetings would be full of carefully worded and graded polite discussion, but just yesterday she told me about a meeting where the lead therapist said to one particular member of the group, 'If you don't do X right, we're fucked. You are fucking us up!' I don't know if that's good or not, but it's not just…

I am not against swearing and I do it as well. I find swearing at people who contribute to code off putting though.

I don't see him swearing at people. I see him swearing at the contribution - at least in this example. There are many instances of him swearing at people and I think he does himself and Linux in general a disservice, but that one? I fail to see the problem.

Re: Linus Torvalds on aliasing

#203

Earlier quoted context omitted.

This is not aimed at you specifically, but I find this decorum policing off punting. Like the U.S. military may be able to control what they say, but some of the things it has actually done are less than nice. I don't care that Linus swears, he hasn't invaded anyone or harmed anyone as far as I know. I don't care that Trump swears, I care about the stupid stuff he actually does . Linus may swear, but he also protects…

I didn't bring the military up to say that it's an authority on proper conduct. Rather, I'm saying that EVEN in the military, with some of the most insensitive people around, swearing indicates lack of self-control and situational awareness.

Sure, swearing may indicate lack of self-control, but the lack of swearing does not indicate self-control, nor does the presence of swearing indicate lack of self-control.

I once saw a doc about the alarming levels of rape in the U.S. military. Some of these guys were pretty high rank, so I guess they fooled everyone that they possessed self-control, (perhaps they didn't swear), but in reality they clearly lacked self-control. I only bring up this example to explain my point, I know there are many officers who don't swear and don't lack self-control, but my point is that the lack of swearing doesn't really prove anything, nor does the presence of swearing.

Re: Linus Torvalds on aliasing

#204
post #184

Earlier quoted context omitted.

In military terms Linus is the president of his world (the Linux kernel). In the military with all the hierarchy this wouldn't happen because no small private would be arrogant enough to throw their opinion in the top generals and president face without being asked. The whole point of the rudeness is that it does give space for people to voice their opinion irregardless of their rank. Only at the risk of being somewh…

The point is that swearing is not equal to honesty. It's just additional emotional metadata.

And this is bad? You would prefer having all metadata substituted by a fake smile?:)

Re: Linus Torvalds on aliasing

#205
post #124

Earlier quoted context omitted.

When it comes to being oversensitive needy little things there is no true Scottsman. As a northern European I find it not only comfortable that Linus runs Linux, but I would be less comfortable if it was another American smile in face pretend to be your friend but be shady as fuck attitude that you guys seem to confuse for 'professionalism'. So let's chalk this to cultural differences. We wouldn't hire someone like y…

As another Northern European I disassociate myself from your comment. Yes, there are cultural differences between the US and Europe. No, that doesn't mean that Europe agrees with your opinion on what constitutes acceptable behaviour in the software community. You do not speak for us.

And neither do you.

Re: Linus Torvalds on aliasing

#206

Earlier quoted context omitted.

I think people's ideas of what's a real conflict can vary. I don't know what Linus's motivation was, probably you know better than me. Is it possible he's trying to engender a culture where Andy pushes back harder on these rationales, rather than just being polite? Quoting Andy: Yeah, there were few reasons why I decide to make that patch (OK, it seems I staked on not the best reason).

If Torvalds is trying to engender a culture by being the only one swearing then I'd be very curious where he learned that technique and how he was measuring its success over the many years he's exhibited that behaviour. Occam's Razor suggests that the more likely cause is that he's just an angry man who can't (or doesn't want to) moderate his behaviour. I don't want to assume too much about your wife's job or persona…

[deleted]

Re: Linus Torvalds on aliasing

#207

Earlier quoted context omitted.

I think people's ideas of what's a real conflict can vary. I don't know what Linus's motivation was, probably you know better than me. Is it possible he's trying to engender a culture where Andy pushes back harder on these rationales, rather than just being polite? Quoting Andy: Yeah, there were few reasons why I decide to make that patch (OK, it seems I staked on not the best reason).

If Torvalds is trying to engender a culture by being the only one swearing then I'd be very curious where he learned that technique and how he was measuring its success over the many years he's exhibited that behaviour. Occam's Razor suggests that the more likely cause is that he's just an angry man who can't (or doesn't want to) moderate his behaviour. I don't want to assume too much about your wife's job or persona…

Can the maintenance of the Linux kernel be considered a success?

Re: Linus Torvalds on aliasing

#208
post #180

Earlier quoted context omitted.

Swearing doesn't damage morale. Many soccer coaches and inspiring pep talks contain swear words. It's a style figure. Tact can be very usefull in small teams where trust and coordination is important. For large projects, with thousands of stake holders the bar to participate in a conversation should be high. As we both say in Holland: we are not made of sugar. But go read Linus rant now and ask yourself: would this r…

Swearing in general doesn't damage morale, but swearing at and verbally abusing someone does very much so. That's exactly the kind of treatment that would lead me, if I were a developer, to walk away from the project. In fact, here's an edit which gets his point over in less words, and more clearly: "Honestly, this looks questionable to me. [U]sing a union to do type punning is the traditional AND STANDARD way to do…

And that's the reason PR exists. To translate text written by "knowledgeable person, who writes in not acceptable to everyone language" into "language acceptable to everyone". This also leads to no more direct contact between public and those people and the eternal cries of "we only get PR speak!!"

The chances that you get to hear things from the source and never hear things in a way you don't like is almost zero. You have to make a decision.

Re: Linus Torvalds on aliasing

#209

Earlier quoted context omitted.

I think people's ideas of what's a real conflict can vary. I don't know what Linus's motivation was, probably you know better than me. Is it possible he's trying to engender a culture where Andy pushes back harder on these rationales, rather than just being polite? Quoting Andy: Yeah, there were few reasons why I decide to make that patch (OK, it seems I staked on not the best reason).

If Torvalds is trying to engender a culture by being the only one swearing then I'd be very curious where he learned that technique and how he was measuring its success over the many years he's exhibited that behaviour. Occam's Razor suggests that the more likely cause is that he's just an angry man who can't (or doesn't want to) moderate his behaviour. I don't want to assume too much about your wife's job or persona…

I was explicitly not talking about the therapy, but the management of the therapy. That's a key distinction here.

Re: Linus Torvalds on aliasing

#210

Earlier quoted context omitted.

The point is that swearing is not equal to honesty. It's just additional emotional metadata.

And this is bad? You would prefer having all metadata substituted by a fake smile?:)

When did we start equating swearing with honesty? It would be strange to hear a prosecutor tell a witness, "You're not swearing - I need you to stop lying".

If anything, swearing clouds what you really mean. "Is he saying 'fuck' because he thinks the policy was unfairly applied, or because it was misunderstood? I don't know bro, but at least he's being honest".

Post reply on HN