Live data from Hacker News

Linus Torvalds on aliasing

yodaiken.com

71–80 of 284 posts

Re: Linus Torvalds on aliasing

#71

When people can't find fault in the technical argument, they start attacking other things like. > Oh! He is so rude, He insults so much. If you have a better argument to counter his logic, please post that, it would be more useful for everyone involved. Posting pretty useless comments here is pretty lame.

I'll critique his prose on efficiency grounds. He wastes many words making a point.

Re: Linus Torvalds on aliasing

#72
post #41

I work with a codebase that implements a sort of OO inheritance in C. It looks like this: #define BASE_FIELDS int a; int b; int c; struct Base { BASE_FIELDS }; struct Derived1 { BASE_FIELDS int d; int e; }; struct Derived2 { BASE_FIELDS int f; int g; }; Then, it has lots of code that accesses Derived objects through a `Base*`, with ->a and so on. Is this against the standard C aliasing rules? If so, how would this ne…

originally fields (or rather structure offsets) in C were GLOBAL and could be used with any struct pointer, the Unix V6/V7 kernels used this to good effect, because of this unions weren't really needed (you just used a different field name from a different structure)

Re: Linus Torvalds on aliasing

#73
post #21
post #11

Come on, this is wonderfully blunt! > In fact, I'll take real toilet paper over standards any day, because at least that way I won't have splinters and ink up my arse.

You can be blunt without being rude. Most of the post is just rudeness.

Rudeness is a cultural variable.

An Englishman saying "that's interesting" can be more rude than someone else saying "get lost"

Re: Linus Torvalds on aliasing

#74
post #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.…

His rant seems directed against the _argument_ that standards should be followed without question.

Re: Linus Torvalds on aliasing

#75
post #63
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;…

No, type punning via unions is a gcc extension. The standard only allows reading a value as the type it was written with or as char, and an access as char is only good for copying. If a char access used different bit order, that would be OK according to the standard because you couldn't tell unless you violated the standard. It seems every compiler will tolerate a memcpy for type punning, even though this isn't requi…

memcpy is legal and fine. To borrow the example from above:

  double d = 3.14;
  uint64_t i;
  memcpy(&i, &d, sizeof(d));
is perfectly kosher.

Re: Linus Torvalds on aliasing

#76
post #30

Linus has done some (okay, lots of) wonderful stuff. However, his attitude here is pretty extreme. Being incredibly rude, then proceeding to merge said pull request. If Linus is willing to merge the PR, then it can't be that bad. Surely there was a more tactful way to approach this, even for Linus.

Why should he NOT being rude? Has anyone ever answered him in the same way? Has anyone ever publicly explained him that while being a sociopathic nerd he still must comply to some basic rules of conduct like we all do. The guy is willingly putting on and supporting the public image he's got and, obviously, loving it. I know, that he's smart and what not, but why should it be an excuse for being an asshole? I just rea…

> Has anyone ever publicly explained him that while being a sociopathic nerd he still must comply to some basic rules of conduct like we all do[?]

Yes.

Back in 2014 several DebConf attendees publicly confronted Torvalds, quoting some of the outrageous things he's written to/at people and making him explain himself. It makes for some rather cringy moments and there is no evidence it had any meaningful impact on him. You may watch it all here:

https://www.youtube.com/watch?v=5PmHRSeA2c8

Re: Linus Torvalds on aliasing

#77

Linus has done some (okay, lots of) wonderful stuff. However, his attitude here is pretty extreme. Being incredibly rude, then proceeding to merge said pull request. If Linus is willing to merge the PR, then it can't be that bad. Surely there was a more tactful way to approach this, even for Linus.

He explicitly says the changes are fine. It's the argument that they should be merged 'because standards' that he's objecting to.

Re: Linus Torvalds on aliasing

#78

Linus has done some (okay, lots of) wonderful stuff. However, his attitude here is pretty extreme. Being incredibly rude, then proceeding to merge said pull request. If Linus is willing to merge the PR, then it can't be that bad. Surely there was a more tactful way to approach this, even for Linus.

>Linus has done some (okay, lots of) wonderful stuff. However, his attitude here is pretty extreme. Being incredibly rude, then proceeding to merge said pull request.

He already writes that he's OK with the code ("can live with it") -- he's against the reasoning that accompanies it.

Re: Linus Torvalds on aliasing

#80
post #27

It's important to bear in mind that Linux isn't written in standard C - it's written in a dialect of C implemented by recent-ish versions of GCC (there is a particular minimum GCC version supported), with certain compiler switches. There's nothing wrong with this - it's an important enough project to be able to make those kinds of demands.

Android kernels are built with Clang. So really it's just missing support for MSVC, for obvious reasons.
Post reply on HN