Better HN
topnewbestaskshowjobs
Log inSign up

nmilo

1,205 karma · joined Jan 2, 2022 (4y ago) · 235 submissions

Submissions

comment 4y ago · link · parent

Why? Isn't one of the ideas of C++ that every constructed object is in a valid state? Even the STL has constructors that can fail, and it does it through member variables/flags, which doesn't seem like a very good solution:

    std::fstream s(filename);
    if (!s.is_open()) {
        std::cout << "failed to open " << filename << '\n';
    }
No one should ever have to use factories, they really suck. Too much boilerplate, too much code duplication.

comment 4y ago · link · parent

But then you would need a local dt for each time-dependent function, and shaders don't really have packaged-up member variables in structs like you think they would if you come from Rust. That means you would have to maintain a massive list of dt's for each time-dependent function your shader calls, and then change this list everytime you introduce or remove a time-dependent function to the shader code. It's a solution that only works in a language that can hide the complexity from the programmer like Rust.

comment 4y ago · link · parent

It's not great, it just has the most users, so it's better just due to the network effect. From a usability standpoint it sucks.

comment 4y ago · link · parent

Not sure what your point is. C doesn't have labelled loops, so a goto signals intent better than the weird exitloop=1 thing in the article. This isn't to say C shouldn't have labelled loops; I think they're better than gotos, it's just that the C committee will likely never add them one of C's philosophies (goals?) is to limit syntactic sugar.

comment 4y ago · link · parent

What a weird post. There's so many cool things Fortran does better than C-like languages, but instead the post focuses on superficial syntax like labelled loops and dangling elses. The labelled loops thing particularly irks me because it's a so often repeated qualm about C yet it's performing the exact same function as a goto--so why not use a goto?

comment 4y ago · link · parent

But here the pieces aren't infinitesimal. They're fractals, but still measurable.

comment 4y ago · link · parent

Yeah you're right, it seems like the article is misleading. Still, unless I'm reading it wrong it seems like the patent is just describing the hardware translation of this algorithm, it's not really adding anything new. It's still dubious to me.

comment 4y ago · link · parent

    There’s another algorithm that doesn’t depend on knowing which value is larger, the U.S. patent for which expired in 2016:

    unsigned average(unsigned a, unsigned b)
    {
        return (a / 2) + (b / 2) + (a & b & 1);
    }
There's no way that should be patentable.

comment 4y ago · link · parent

One thing that isn't often mentioned is that complicated programming languages nearly always come with complicated tooling. C++ has cmake, which is self-explanatory, and even cargo is pretty complicated. I'm still not sure what is a crate vs. a package, and the amount of times I've had to look up the bindgen tutorial, and the amount of steps involved, is too much. This isn't even to mention compile times, debug-mode executable speed, etc. This isn't the complexity moving from the source code to the tooling, this is complexity created in the tooling itself required to manage the complexity created by the language.

comment 4y ago · link · parent

There's a pretty big difference between doing dynamic memory allocation for string concatenation on ALL systems, and doing software addition on some embedded processors. Even on your embedded system, floating point addition is simpler than string concatenation.

comment 4y ago · link · parent

What is a case where floating-point addition is more complicated than a string concatenation? Are you referring to some obscure architecture?

comment 4y ago · link · parent

In 50 years everyone will have moved on to the hot new language, but your OS will still run, at least some, C code. Whether you like it or not C has enough inertia to last a really, really long time.

comment 4y ago · link · parent

I think that idea is pretty cool. I don't like the new closure pointer type, and how all functions that take function pointers need to be retrofitted to take closures as well, but I guess it's necessary. I assume closure pointers would be implemented as a double pointer, one void* to point to the captured variables in memory, and one function pointer to point to the procedure. One of the most annoying parts of C is how callback logic needs to be defined completely separately from the calling logic.

comment 4y ago · link · parent

Then it doesn't need to use the existing attribute syntax, which requires that attributes can be ignored. They can make a new syntax.

comment 4y ago · link · parent

I really don't like it. The lambda stuff, especially the captures that were ripped from C++, don't fit C at all. The question about whether it should be cleaned up at end-of-scope or end-of-function is too ambiguous and debated. And if I'm understanding this correctly, this is the worst part:

> This indicates that existing mechanism in compilers may have difficulties with a block model. So we only require it to be implemented for function bodies and make it implementation-defined if it is also offered for internal blocks.

How will that work?

comment 4y ago · link · parent

It's fun and small

comment 4y ago · link · parent

Artists make most of their money from touring and merchandise. It's the labels that benefit off of their copyright-given monopoly.

comment 4y ago · link · parent

Coming from someone that has been using an old computer for a while, I could definitely tell the difference between Electron and non-Electron apps based on their speed. E.g. Spotify and Discord. They take forever to start (the worst part IMO), there's significant lag when changing pages, and they just feel bad to use. If you've never noticed it, then your computers are very good.

comment 4y ago · link · parent

I'm not defending the industry or the case at all. I'm just saying that saying "youtube-dl is technically a browser", and letting the defense rest its case, is the kind of technically-correct nonsense that often gets written on HN but would never work in the real world.

comment 4y ago · link · parent

They would certainly agree. Most of their work involves playing the cat-and-mouse game of youtube-dl vs. YouTube, all coming from the fact that YouTube never intended people to view their content using youtube-dl.

comment 4y ago · link · parent

The law isn't based around technical gotcha's but instead on how human judges judge things. It doesn't matter that, if in some very techincally-correct viewpoint, youtube-dl is in theory performing the same actions as a browser. youtube-dl is not a browser, you and I both know that.

comment 4y ago · link · parent

If you walked into a store and the cashier was unconscious, would that not be stranger than if the cashier was conscious?

comment 4y ago · link · parent

Funny to note that the top post of all time in r/poor is someone telling people to "Buy even 10 dollars in Bitcoin at a time if that's all you can spare," with investment advice stating:

> It's the best way to save/grow an emergency fund. And if you can hold indefinitely, then you can grow true financial freedom by saving even just 5 dollars at a time, anytime you can spare to do so in Bitcoin. Don't think of it as an investment, think of it as a savings account that works and doesn't lose buying power thanks to inflation.

comment 4y ago · link · parent

Agreed. Beating bad habits/addictions is a change in mindset and identity. OP's system will work for a bit, and then it just takes one lapse of judgement for OP to inevitably turn the shortcut off for the last time, never to turn it on again. If OP told himself that "I am not a Twitter user" rather than "I have a mild Twitter addiction" it would be much easier to stop, just like the book tells people to think of themselves as "not smokers" rather than "trying to quit." Remember there is no value in Twitter or TikTok; if you think there is, your brain is lying to you.
1
45678