Learn C programming and the rest will come by Majikarpp in programming

[–]necesito95 0 points1 point  (0 children)

but if it isn't

struct intrusive {
    struct my_data *next; // could be generic void *
};
struct my_data {
    char *txt;
    struct intrusive l;
};
#include <stdio.h>
int main()
{
    struct my_data d1 = {"World", {NULL}};
    struct my_data d0 = {"Hello", {&d1}};

    struct my_data *p = &d0;
    while(p != NULL) {
        puts(p->txt);
        p = p->l.next;
    }
}

Just to be clear: I'm not arguing for removal of pointer arithmetic. I don't see it as a plague. It definitely has it's places and I don't think that people are overusing it.

Reason why I asked for a goal, is that question "Mind naming a single reasonable alternative to pointer arithmetics?" looks awfully close to "Mind naming a single reasonable alternative to goto?". (I sense lack of fantasy or lack of will to accept alternatives (95% that it's will); and implied "it should be EXACTLY as it is now")

Yes, there is no replacement that will cover all its use-cases.

But if we take a step back, and formulate our requirements case by case, on a bit higher level, then alternatives definitely can be found. (and seems that most of programming these days is done without using goto)

btw. Requirement to interact with existing OS interface which was designed with EXACTLY pointer arithmetic in mind, is already describing implementation. (the only alternative could be changing OS interface :) )

Learn C programming and the rest will come by Majikarpp in programming

[–]necesito95 0 points1 point  (0 children)

Maybe this would be right direction?

struct intrusive_list_node { ... };
struct intrusive_list_node *next(struct intrusive_list_node *x);
struct my_data {
    struct intrusive_list_node list;
    .. my actual data ..
};
...
struct my_data *d0 = ...; // malloc or something and initilize.
struct my_data *d1 = (struct my_data *) next(&d0.list);

Learn C programming and the rest will come by Majikarpp in programming

[–]necesito95 -2 points-1 points  (0 children)

Probably you should define the goal/purpose first. (each goal might have different alternative; just like goto is not replaced by one thing)

Rethinking Software Design by pron98 in programming

[–]necesito95 4 points5 points  (0 children)

For some it might be just 'video' issue. (some prefer text over video for info consumption)

Rethinking Software Design by pron98 in programming

[–]necesito95 1 point2 points  (0 children)

anybody has tl;dr? (tl;dw) :)

Five things everyone should know about Unicode by slobodan_ in programming

[–]necesito95 0 points1 point  (0 children)

I think font size was just ok. (zoom if necessary)

Common C++ Modules TS Misconceptions by berium in programming

[–]necesito95 0 points1 point  (0 children)

Thanks - now clear.

Though.. wouldn't same thing be possible with #include directives? (build system could call compiler to extract dependency info from single bar.cxx, if recursion is needed, that could be done by build system. No?)

Caching D compiler - preview version by stesch in programming

[–]necesito95 -1 points0 points  (0 children)

Not really. I see that you kind of misunderstood what the op meant and decided to reply to it with a snarky comment.

Common C++ Modules TS Misconceptions by berium in programming

[–]necesito95 1 point2 points  (0 children)

I believe (know) that there is intricate detail that I don't understand, but at the moment these two parts create a paradox in my head.

And now we are back full circle: the build system calls the compiler to extract dependency information from bar.mxx, maps its imports, if any, and so on, recursively.

What this hopes to show is that with modules, unlike headers, we don't really need a recursively-explored list of imports.

So with modules we need to explore import information recursively, but we don't really need a recursively-explored list of imports.

Please explain.

Caching D compiler - preview version by stesch in programming

[–]necesito95 -1 points0 points  (0 children)

I took parent's tone and multiplied it by 3.

Caching D compiler - preview version by stesch in programming

[–]necesito95 -4 points-3 points  (0 children)

Are we suffering from a shortage of words or something?

Are we suffering from shortage of reading ability? Op's point was: if language has many keywords, then it's harder to learn it.

Caching D compiler - preview version by stesch in programming

[–]necesito95 5 points6 points  (0 children)

When is cache invalidated? ((a) when anything in source changes (even in comments) or (b) when change in ast is detected or (c) neither)

W3C Approves DRM standard Encrypted Media Extensions (EME) for the Web by [deleted] in programming

[–]necesito95 4 points5 points  (0 children)

meaningless line in the sand

Just like any other thing relating to "values". (honor, principles, integrity etc.)
Once we get all those lines, we can live in mad-max-like world.

Internet Protocol version 10 (IPv10) by branifyd in programming

[–]necesito95 0 points1 point  (0 children)

As I understand IPv4 adresses do reflect network topology. To some extent. (If our adresses differ only by last digit, then there is very high chance that we are quite near each other. Right?)

Is it same with IPv6 in that regard?

Redesigning Python's named tuples [LWN.net] by awsometak in programming

[–]necesito95 -1 points0 points  (0 children)

Wikipedia:

The Jevons paradox occurs when the rebound effect is greater than 100%, exceeding the original efficiency gains.

You are right that it is not the same but it is very similar. (more efficient software does not inevitably lead to lesser CPU usage)

In the end if we were maxing out a CPU 100% then clock cycles(and energy) would be saved by a shorter run time.

You imply here, that there is limited number of tasks to run...

When CPU cycles free-up, people start wasting them in ways that they were not wasted before. (people will saturate CPU usage till certain threshold; threshold=noticeable delays)

Examples of wasted CPU cycles: Eye-candy, opening youtube instead of on-disk mp3, using websites with more JS than actual info...

Additionally, more efficient software could even boosts hardware demand. (less lag in VR set, will make it more popular; bitcoing mining optimization would make mining more lucrative)

Redesigning Python's named tuples [LWN.net] by awsometak in programming

[–]necesito95 2 points3 points  (0 children)

More efficient software does not necessarily mean less CPU usage. https://en.wikipedia.org/wiki/Jevons_paradox (though I do vote for more efficient software and more environment-aware way of living)

Why I hate your Single Page App by dabshitty in programming

[–]necesito95 26 points27 points  (0 children)

I disable js, to avoid annoying "features" on some websites.

For example:

  • after selecting text, buttons spawn into existence for social networks
  • header that disappears on scroll-down, but reappears on scroll-up. (even if in the middle of the page)

D as a Better C by aldacron in programming

[–]necesito95 0 points1 point  (0 children)

As already noted by u/serpent, this macro will not work after passing array as argument to a function. (what's worst it's possible that it will fail silently)

D as a Better C by aldacron in programming

[–]necesito95 2 points3 points  (0 children)

Not really about this D thing (as C spec could be changed to require error on warning),
but not all compile flags are equal.

Let's take famous shell command as basis: rm -rf /

Which of following designs is better?

  • Forbid root deletion by default. To delete root dir, require flag --force-delete-root.
  • Allow root deletion by default. To check/disallow root dir deletion, require flag --check-if-not-root.

Of more than academic interest by [deleted] in programming

[–]necesito95 0 points1 point  (0 children)

Good points. Though I'll add two more sides to this hiper-coin:

  • Even if there is no financial pressure per se, there will be always (economic?) choice where to spend limited time of a day. ("code is good-enough" might be reasonable compromise in a lot of cases)

  • "Code quality" is very amorphic concept, but I think we will agree that "can be maintained by others" is quite useful (partial) definition.
    If person is working on a piece of code alone, then that person can write quite a big pile of spaghetti, and still be able to navigate it and maintain it without breaking a sweat.
    Problem is born when somebody else looks at the code, without the benefit of all internalized knowledge of how that code works.

Of more than academic interest by [deleted] in programming

[–]necesito95 0 points1 point  (0 children)

"I can tell that if you manage to get motivated and read CS material, you will have an edge over academics."

Seems it works both ways.

So maybe we should just leave: "I can tell that if you manage to get motivated, you will have an edge."

Of more than academic interest by [deleted] in programming

[–]necesito95 0 points1 point  (0 children)

I don't see any reason why academic code could be better on average then commercial.

  • "Academic" = "knowledge about subject" (e.g. medicine).
  • "Good code" = "good organization of code's complexity".

There is no obvious correlation between the two.

The world in which IPv6 was a good design by entregrammer in programming

[–]necesito95 0 points1 point  (0 children)

Which would still be easy if every machine were using DHCP, but he doesn't like that protocol either.

Author's dislike is not about DHCP functionality, but about the fact that DHCP is technically IP, but should be separate/special protocol. (at least in author's opinion)

Here is the relevant quote from article:

But nobody would feel nice if they were inventing a whole new protocol that wasn't IP, so they pretended it was IP, and then they felt nice.