Live data from Hacker News

Linus Torvalds on aliasing

yodaiken.com

101–110 of 284 posts

Re: Linus Torvalds on aliasing

#101

raises 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.

You have to realize that extreme PC thing is very US centric and pretty recent at that.

Re: Linus Torvalds on aliasing

#102
> The fact is that gcc documents type punning through unions as the "right way". You may disagree with that, but putting some theoretical standards language over the explicit and long-time documentation of the main compiler we use is pure and utter bullshit.

this was the whole point of the rant.

Re: Linus Torvalds on aliasing

#103
post #50

Earlier quoted context omitted.

Reading on a 400dpi 300nits screen in a slightly dark room, the lkml link hurts the eyes significantly more. Reading on a shitty 96dpi 100nits screen from 2004 in a bright room, the lkml link is the more readable one. Another situation of the eternal issue of "we need a web standard for specifying relative contrast", not "make everything blinding #000 on #fff".

Or perhaps do not specify any dumb colours, let the browser do its job of presenting things. Oh wait, you know you can switch CSS to default layout? Perhaps the browser could use an option to still apply layout but ignore formatting and colours.

The problem is that browsers are generally really terrible at presenting text in a readable and good-looking way. Compare http://motherfuckingwebsite.com/ and http://bettermotherfuckingwebsite.com/ - most people would agree that the second is significantly easier to read.

I really wish browsers' default formatting could be trusted to be as readable as possible, but alas.

Re: Linus Torvalds on aliasing

#104
post #93
post #88

Earlier 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.

Don’t think c++ allows it. Last time I checked, if you use any modern compiler, and do a memcpy, and check the assembly, it does the right thing.

Re: Linus Torvalds on aliasing

#105
post #50
post #18

Here is a slightly more readable version that's not white-on-white, half-pixel-thick text: https://lkml.org/lkml/2018/6/5/769

Reading on a 400dpi 300nits screen in a slightly dark room, the lkml link hurts the eyes significantly more. Reading on a shitty 96dpi 100nits screen from 2004 in a bright room, the lkml link is the more readable one. Another situation of the eternal issue of "we need a web standard for specifying relative contrast", not "make everything blinding #000 on #fff".

Also useful would be a standard way to normalize the apparent size and weight of different fonts so the fallbacks won't look like shit. Apparently my problem is more with the Courier font bundled with Ubuntu, as replacing Courier on that page with just about any other font makes it somewhat readable (still a "disabled" gray, but at least visible).

Re: Linus Torvalds on aliasing

#106
post #93

Earlier quoted context omitted.

>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.

Don’t think c++ allows it. Last time I checked, if you use any modern compiler, and do a memcpy, and check the assembly, it does the right thing.

Yes, that's the "approved" way of doing type punning. Any decent compiler will immediately optimize that down to nothing.

Re: Linus Torvalds on aliasing

#107
post #80

Earlier quoted context omitted.

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

Clang was made to support GCC extensions and be as close to a drop-in replacement for GCC as possible. Linux misses support for MSVC, Intel C Compiler, XL C and basically every other C Compiler ever written except for these 2.

Clang doesn't support every GCC extension, though. For example, nested functions is something that it doesn't do.

Re: Linus Torvalds on aliasing

#108
post #84
post #38

Earlier quoted context omitted.

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...

It's also people who throw fits with little provocation when they don't like things, which sounds fitting to me. Seriously, the thing gets merged anyway but he has to "express himself"

Re: Linus Torvalds on aliasing

#109
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.

Type punning to char* is explicitly allowed. (But going from char* to any other type is not...)

And void *, obviously.

Re: Linus Torvalds on aliasing

#110
post #101

raises 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.

You have to realize that extreme PC thing is very US centric and pretty recent at that.

PC? This is not politically correct, this is an opinion based on free will and self-respect. “I don’t want to volunteer where the boss is an abusive asshole.” By what definition is that PC?
Post reply on HN