Live data from Hacker News

Linus Torvalds on aliasing

yodaiken.com

81–90 of 284 posts

Re: Linus Torvalds on aliasing

#81
post #69
post #63

Earlier quoted context omitted.

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…

Does this mean that memcpy() is really more of a language construct than a library function, since it cannot be implemented correctly in fully defined standard C?

Yes. Check here for a discussion: https://blog.regehr.org/archives/959

Re: Linus Torvalds on aliasing

#82

i really wish a person many software engineers idolize or at least obviously respect and pay attention to, myself being excluded from these camps, didn’t communicate like a child. it’s an embarrassment for the field.

Children communicate like that?

Re: Linus Torvalds on aliasing

#83
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…

>Why should he NOT being rude? Has anyone ever answered him in the same way?

Several, but no one that mattered enough with respect to Linux for his opinion to matter in return.

His OS, his rules. Others can always fork it if they have an issue with that.

It seems to have worked fine as a gatekeeping technique for the last 25+ years, even if it hurts some feelings. Linus goes for an in-the-trenches, rough camaraderie, approach, rather than a "professional soft spoken cubicle workers" approach.

Re: Linus Torvalds on aliasing

#84
post #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?

It's actually like a rough drill sergeant.

"Spoiled little princesses" are those that can't take some strong words and need hugs and smiles...

Re: Linus Torvalds on aliasing

#85

Earlier quoted context omitted.

Better security in general maybe? The mainline kernel community is known for its conservatism on introducing security mitigation that may affect development in other ways. In comparison, BSD is more security-minded (M* Money per Linus). Although much has been changed after KSPP.

Except BSD even being older than Linux never really took off either in Desktop space or Servers.

What are you talking about? BSD sees plenty of use, for its support of zfs, dtrace, and jails alone.

Unless you're heavily invested in the Linux kernel and Linux-only tech, I'd advise to keep your software running on the BSDs as well as Linux to avoid monocultures in your own best interest. The strength of F/OSS is in giving you choice, eg. by providing two (or more) interchangeable, excellent O/S's and compiler suites.

Re: Linus Torvalds on aliasing

#86
post #54

Doesn't C have something better than that type punning via union to achieve the same effect? I understand Linus reasoning, but still it's an ugly hack.

See other comments, some variant of "type punning via union is not allowed according to the C standard" is what made Linus responding like that. Moreover, even using union for that is a compiler switch in gcc, to avoid compiler following "the standard." Linus points that following the standard is definitely wrong thing to do:

"When documented gcc behavior says one thing, and the standard might be unclear, we really don't care one whit about the lack of clarity in some standard."

I think the union thing was at least initially implemented as not functioning at all in clang, where developers "followed the standard."

Re: Linus Torvalds on aliasing

#87
post #67

Earlier quoted context omitted.

> It is not unfair, because the majority of "developers contributing to it" are on those company payrolls, 8h a day during a full week. Why don't the devs at those company contribute to BSD then? Care to reflect on this?

MIT license, they don't need to. How much code do you think they got back from Sony, Apple, companies selling routers with BSD on them? Even Google prefers to build their own OS from scratch with MIT license (Fuchsia) than keep on using Linux for that effort. They already reduced GPL use to the bare minimum on Android by removing gcc. Then there was the whole suit which made most companies loose interest to be involv…

FreeBSD uses BSD License, no? Or am I missing something here? https://www.freebsd.org/internal/software-license.html

Re: Linus Torvalds on aliasing

#88
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.…

>C was created for writing operating systems

That doesn't properly justify C's minefield around aliasing and type punning in general. It's UB galore. Thing is, whenever you're writing low level code that's tied to hardware in my experience you very often end up having to pun your types to match hardware constraints, and at this point the C standard basically says "lol good luck with that bro".

I'm not a programming language expert but IMO at the very least C should make reading from a different union member than was last written to "implementation defined" instead of UB (with suitable constraints if the sizes of the members differ I suppose). In effect that's mostly how compilers deal with that anyway.

So I agree with Linus that the C standard is really unhelpful in these situation, although his childish anger is unnecessary and counter-productive.

Re: Linus Torvalds on aliasing

#89
post #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.

Let's stop policing speech, alright? You can use as many words as you want to express your views. I personally would not use the same words he might use, but let's not be hypocrites and say that none of us have written an angry or frustrated response to something that we think is stupid and just plain wrong.

Re: Linus Torvalds on aliasing

#90
post #42

Earlier quoted context omitted.

> Fork it and make your own Even Google couldn't pull that off with Android.

Another question is would Linux become what it's become if everyone would really have just forked it?

> ... if everyone would really have just forked it?

well, if you can keep pace with it, why not ?

Post reply on HN