So Linus, made my day!
Linus Torvalds on aliasing
161–170 of 284 posts
Re: Linus Torvalds on aliasing
#162Earlier quoted context omitted.
> 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.
Good code or not, if he doesn't agree with the reason to merge it, why merge it?
This is for history. If someone, later, say: "We should use union aliasing to fix this", someone would argue "No, we shouldn't because we already states _there_ that union aliasing is bad".
You can't consider a such amount of code like the kernel one without its commit history.
Here Linus explain why union aliasing is not "bad" per see, but considered "bad" because the C standard say so and he clearly explain standards are not holy book and compiler implementation is as important (something he always states).
Re: Linus Torvalds on aliasing
#163I would go out of my way to avoid people who communicate like this with me. People put time and energy in making software better, at least in their own eyes, for others and then they get textually abused like this by someone who has his fame to protect himself with. He also does no service to his own arguments by peppering them with childish swearing because things like "So standards are not some kind of holy book th…
Re: Linus Torvalds on aliasing
#164I 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…
That is well-defined. "One special guarantee is made in order to simplify the use of unions: if a union contains several structures that share a common initial sequence (see below), and if the union object currently contains one of these structures, it is permitted to inspect the common initial part of any of them anywhere that a declaration of the complete type of the union is visible. Two structures share a common…
Re: Linus Torvalds on aliasing
#165I would go out of my way to avoid people who communicate like this with me. People put time and energy in making software better, at least in their own eyes, for others and then they get textually abused like this by someone who has his fame to protect himself with. He also does no service to his own arguments by peppering them with childish swearing because things like "So standards are not some kind of holy book th…
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…
Re: Linus Torvalds on aliasing
#166Earlier quoted context omitted.
>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 l…
>at the very least C should make reading from a different union member than was last written to "implementation defined" That's how it is :) The standard even describes union behavior as "type punning". I don't know if C++ allows it though.
union { int i; float f; } u;
You can't safely call a function with pointers to the members like func(&u.i, &u.f), because when func was compiled, the compiler couldn't know that the arguments are pointers to union members.
This sort of thing scares me, because what the compiler can "see" isn't well defined. Is it ok if func is in the same file? Probably not. How about if I don't send the pointers to an other function and just use them locally? Probably ok, but I wouldn't trust it. If you want to type pun with a union, make sure to always access the members through the union, not with direct pointers.
The only method of type punning I 100% trust is memcpy, and if you get lucky the compiler might optimize away the overhead for you.
Re: Linus Torvalds on aliasing
#167Earlier quoted context omitted.
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.
There is no true Northern European.
I'm sure the difference is due to lattitude. A little bit of getting heated is ill advised in the scorching sun.
Re: Linus Torvalds on aliasing
#168I would go out of my way to avoid people who communicate like this with me. People put time and energy in making software better, at least in their own eyes, for others and then they get textually abused like this by someone who has his fame to protect himself with. He also does no service to his own arguments by peppering them with childish swearing because things like "So standards are not some kind of holy book th…
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…
This is a false dichotomy.
Most of what Linus says would run foul of HN's guidelines - which I'll paraphrase here as "don't call someone an asshole before making your real point", but that doesn't mean that everyone on HN is a 'smile in face pretend to be your friend but be shady as fuck'.
Re: Linus Torvalds on aliasing
#169I would go out of my way to avoid people who communicate like this with me. People put time and energy in making software better, at least in their own eyes, for others and then they get textually abused like this by someone who has his fame to protect himself with. He also does no service to his own arguments by peppering them with childish swearing because things like "So standards are not some kind of holy book th…
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…
I never said that Linus should be fake friendly. I am saying that swearing does damage to moral and the power of his arguments.
Also, Steve Jobs was a notorious asshole and he is revered in the US despite this. There are countless other examples of CEOs and managers who are more than unfriendly in the US who are looked at as examples of how one should behave to be 'professional'.
Your being 'northern European' has nothing to do with any of what we are talking about. Maybe you can chalk your reaction to your apparent false sense of superiority over friendliness and, it seems, Americans.
Re: Linus Torvalds on aliasing
#170raises hand I would love to be able to contribute to the linux kernel one day. But I'm unlikely to ever become part of the community when its leader behaves like this.