Live data from Hacker News

Linus Torvalds on aliasing

yodaiken.com

41–50 of 284 posts

Re: Linus Torvalds on aliasing

#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 need to be rewritten to conform to the standard?

Re: Linus Torvalds on aliasing

#42

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.

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

Re: Linus Torvalds on aliasing

#44
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?

Funny, that people adore when Linus does it, but dislike when somebody else does that to Linus... Okay, whatever.

Re: Linus Torvalds on aliasing

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

It is against the rules. To fix that, you'd need to put a field of type 'struct Base' in the derived struct(s) rather than just copying its fields.

edit: If you want to keep the existing syntax and can use GCC extensions, it should be legal to use an unnamed union:

    struct Derived1 {
        union {
            struct Base base;
            struct {
                int a; int b; int c;
            };
        };
        int d; int e;
    };
edit2: or, with -fms-extensions, just

    struct Derived1 {
        struct Base;
        int d; int e;
    };

Re: Linus Torvalds on aliasing

#46

Earlier quoted context omitted.

He gets frustrated with people that are supposed to be experts but that don't match up to that in practice (in his eyes at least)

Nobody is expert and everybody makes mistakes. He should probably lower his expectations.

You don't write Kernel and maintaining quality by keeping low expectations.

Re: Linus Torvalds on aliasing

#47
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?

Another question is would Linux become what it's become if only nice polite guys were allowed to code it?

Re: Linus Torvalds on aliasing

#48

I sometimes wonder what the world of computing, or even the world in general, would look like today if Linus Torvalds hadn't existed, or happened to have not gotten into computers.

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.

Re: Linus Torvalds on aliasing

#49

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.

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

Just wait and see.

https://www.techradar.com/news/google-fuchsia

Re: Linus Torvalds on aliasing

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

Post reply on HN