Hacker Newsnew | past | comments | ask | show | jobs | submit | ralferoo's commentslogin

> Here, the simplification analysis uses the conditional hidden in the assert() macro to figure out that we only execute the urem instruction if cur < count (see the isImpliedByDomCondition() method). This can have the unexpected consequence of making builds with assertions enabled faster in some cases; we can restore performance by replacing disabled assertions with assume attributes, which have no runtime impact.

It surprises me that the compiler doesn't still take the inference from the assert and just disable emitting the code to perform the check. Over the last 15 years I've worked on many codebases that are written with unnecessary asserts, partly as documentation, but maybe because people assumed it helped the compiler.

I've also worked on many codebases (and written code like this on my own projects) where the code looks like: assert(condition); if (condition) { ... } because I still want that safety check in release builds, and want the exception in debug builds but absolutely not ever in release builds.


> It surprises me that the compiler doesn't still take the inference from the assert and just disable emitting the code to perform the check.

That's because that's what the <assert.h> assert() must do; it's specified to do and imply nothing when assertions are disabled. (the standard literally fully defines it as `#define assert(...) ((void)0)` when NDEBUG)

Whereas `[[assume(...)]]` is a thing specifically for that "infer things from this without actually emitting any code".


Yeah, good point. Honestly it's been so long since I've added that to a project (it's normally hidden in some include that everything else includes) that I'd forgotten it wasn't a compiler level reserved keyword for C++ code.

> It surprises me that the compiler doesn't still take the inference from the assert and just disable emitting the code to perform the check.

The compiler isn't as clever as I think you're envisioning: assert() only works that way because it exits the control flow if the statement isn't true.


My point is that even though the assert() is optimised out, the compiler could still assume that the condition is valid.

How? The assert() has no special significance to the compiler at all, it's just code. Usually it's just an empty macro for non-debug builds.

I guess you could define your assert() use [[assume]] in C++ for non-debug builds... but that seems like a very bad idea to me.

Just leave the asserts in prod. They almost certainly don't have measurable overhead. The few that do can be dealt with separately.

The Linux kernel has thousands of asserts which are always checked at runtime (BUG_ON).


There's an interesting comment on this over on Lobsters: https://lobste.rs/s/e4y5ps/two_studies_compiler_optimisation...

I wonder if that's actually related to the Afrikaans word "stoep", where it's used in the sense of verandah which is obviously where you'd sit outside the house and watch the word go by. Both meanings ultimately come from the original meaning of the word as "step".

I mean...

they are written the same...

And given that it is Afrikaans, I guess so. Afrikaans always reads as "Dutch but it's a puzzle!" to me.


From the wikipedia article linked to just below this reply, it says that the first such experiment is as you described. But then goes on to say:

Other 19th-century experiments were purported to show that frogs did not attempt to escape gradually heated water. An 1872 experiment by Heinzmann was said to show that a normal frog would not attempt to escape if the water was heated slowly enough, which was corroborated in 1875 by German scientist Carl Fratscher.

I don't see the point of the experiment with the brain removed, but given that they did the experiment with intact frogs as well confirms their original hypothesis.

However, later on in the article, it's been disputed in recent years: as the water is heated by about 2 °F (about 1 °C), per minute, the frog becomes increasingly active as it tries to escape, and eventually jumps out if it can. Earlier it also says that frogs put into already water just die (not mentioned, but presumably from shock) and so don't have a chance to start attempting to jump out. I imagine humans dumped into boiling water would have a similar response.


Frog boiling seems like an active research field. I wonder what the social dinners are like at their conferences.

Because you'll loose half a career's worth of inflationary salary rises that way. Also, women might work part time after having children which would skew the average annual salary down. Over a 40 year career, just from inflation alone, you'd be getting about half your final salary that way, even ignoring any increases later on from being better qualified or taking on more responsibility.

Mind you, in the UK, defined benefits pension schemes are very rare nowadays, but where they exist they are defined as a percentage of the final year salary with that company, so the highest 2 year thing seems a bit weird to me but for a different reason.


Highest 2 year is an attempt to address the edge cases around 1 year (especially final year).

You can adjust for inflation and only exclude year where you don't work full time.

I agree with a lot of this. For context, I'm very fat, so I feel a bit more that it's OK to say this, but yeah the body shaming stuff is a very interesting topic.

Obviously, if you feel that your whole life you're being bullied, then it's definitely right to be empowered someway to get someone to stop bullying you that way.

But we seem to have gone way beyond stopping body shaming and to promoting body positivity, which I think is dangerous. We shouldn't be teaching kids that it's OK to be fat and that's just a personal choice and not to change.

The simple fact is that being overweight leads to a lot of health issues. I'm fortunate that my body still tolerates being able to run, but at my BMI that's by no means a guarantee long term. I know that realistically, I need to drop 1/3 of my body weight ASAP and keep it off, or the chances of me living another 20 years is actually quite low.

I know exactly the issues with weight loss and how hard it is. At least 3 times in my life, I've lost 25% of my body weight through dieting, but it's always a constant struggle to keep that off if I ease off even a little bit. Most of the times I've regressed, it's been a combination of factors - an injury so I can't go out running for a few months, maybe winter so it's cold and wet and I'm also avoiding my daily lunchtime walk, and maybe my work is really boring so I'm comfort eating a bit more than I need each day, and suddenly before you even realise it, all the weight has suddenly re-appeared, and each time it's harder than the last to get rid of it and keep it off for good.

But definitely, we want a bit of that stigma to remain. Knowing that I'm fat and that most girls don't even look twice at me, or knowing that the health risks are very real and every day I stay fat, it's doing even more damage to my body... it all sucks in the moment, but it's all helping the motivation that something needs to change. It's not OK to just do nothing.


Yeah I think we agree. Clearly being overweight is not good and should be disencouraged, even apart from your own health, an overweight or obese person in a society just takes more a lot more resources go support, either causing a burden on the person themselves or on the society in which they live in. If that person gets to a healthy weight they can be more productive and require less healthcare support, this is true in almost all cases, and so it's just a win-win if we can get as many people as healthy as possible. This should include not just being "not-overweight", but also being very underweight, being sedentary, having an unhealthy diet, or bad mental health. All of those things if improved cause wins to everyone involved. I'm not 100% on board with the idea to measure people's inherent value by their productivity, but I believe most people tend to enjoy being productive and contributing to their community. There's no downside in decreasing the amount of people who are an unhealthy weight.

I think the issue with stigma is it's so hard to keep in balance, I want people to care of their health, and that'll take knowing that being a healthy weight is in fact good, but doing so in a non damaging way is super hard. In my mind I kind of see smoking at an okay "shame-level" (though you can correct me, maybe I'm straight up wrong on this). Nowadays everyone knows that smoking sucks (let's avoid the whole vape thing for now), it destroys your lungs, and eventually it kills you. But the stigma I saw in relation to smoking just seems more normal and proportional, people generally don't really like being around cigarettes, which is fair, and some people silently judge you, some will tell you to stop smoking, but... there's just not this need to denigrate people for their smoking habit the way it is for being overweight. Now, in the end you'll still feel miserable when you'll start trying to quit/lose weight, but there's nothing really to be done about that, that's just nature.

Honestly I think the underlying cause for this is some of the innate human behavior we still have as a species. We often view being unattractive (which being overweight usually is for most people) as a big moral fault, which gives you a pass to punch down on the person for this transgression. I think we kind of view overweight people in the same lens as someone who did something disgusting, and this might happen completely outside of our conscious comprehension. It then takes conscious effort not to feel that way by default. Honestly this might not be fixable, and maybe there is no way to fix shaming of overweight people on the societal level. All I know is if we help as many people as possible to lose weight, the amount of people shamed will go down that way, too.


I'm not sure if they're still available, but the PAP2T was a wonderful piece of kit - just an ethernet port and 2x RJ-45 jacks for old style phones. You can set up custom dial plans and use any VOIP SIP provider you like. You can trivially edit the dial plan to restrict certain number prefixes, and set up custom short numbers - so for instance my "landline" had 81 for my mum, 82 for brother, 83 for sister, etc. but you could also just dial regular numbers.

If you run an asterisk server on your own box, you could easily set up a private SIP network just for you and your kids, or your kids and their friends, etc. and either run a SIP client on your mobile for your use and a VOIP SIP gateway if you want your kid to be able to call a friend's mobile.

EDIT: I just looked and the PAP2T has been discontinued, but there seem to be lots of units available new from China that look identical and are sold as Linksys PAP2T, and some unbranded units that look the same but with blank labels. I've no idea if these are fully compatible with the real PAP2T, but they might still be worth trying.


Grandstream currently has a line of Analog Telephone Adapters (ATA)[1] that fit this use case.

[1]: https://www.grandstream.com/products/gateways-and-atas/analo...


Just googling it now and TCP urgent data seems to be a mess.

Reading the original RFC 793 it's clear that the intention was never for this to be OOB data, but to inform the receiver that they should consume as much data as possible and minimally process it / buffer it locally until they have read up to the urgent data.

However, the way it was historically implemented as OOB data seems to be significantly more useful - you could send flow control messaging to be processed immediately even if you knew the receiving side had a lot data to consume before it'd see an inline message.

It seems nowadays the advice is just to not use urgent data at all.


I think you're misinterpreting what his comment meant. I read it as meaning that e-commerce has been optimised repeatedly over the 30 years, from a basic start (which as you pointed out was haphazard) to the point where it is now optimised to extract every possible cent from the user, whether by encouraging them to buy with one click (the Amazon one-click patent must be around 20 years old now), time-limited promo spot pricing, sending you e-mails about what you had in the basket if you don't complete a sale, etc...

Right now, by comparison, it sounds like AI based shopping is still in the very early stages. Maybe further along than the early e-commerce, but still with a long way to go in its evolution. That'll probably happen quicker than with e-commerce, because a lot of the knowledge about what does or doesn't work has already been learned, but it sounds like it's still a long way behind. Caveat - I've never used it myself, so I don't know how far it is along that path, I'm just basing that from the article.


Nowadays, I primarily only use gmail because the mail client is good on Android. But all my accounts have been self-hosted for years now and gmail just reads them via POP3 (never managed to get it happy with IMAP for some reason) and sends via my own SMTP.

Can anyone recommend actually decent and free Android (and also web) mail clients for self-hosted use? Everything I've tried so far (but to be fair, it was a few years ago when I last checked) just felt clunky compared to gmail, so I've ended up sticking with it as a client far longer than I probably should.


I've been using FairEmail[1] for some years now as a replacement and find it superior to the gmail app. Of course, depending on your needs and tastes, I could also understand calling it a bit clunky. It is FOSS, but has a one time pay premium option for some advanced features. But really, it's also just fair to support the dev by buing the app. My only complaint would be, that there are to many updates, but of course, you can just ignore them and do them every few months instead.

[1] https://email.faircode.eu/


thunderbird (formerly k9 mail) is a decent enough android app, but im not very picky when it comes to email either so keep that in mind. ive been using it with posteo for about 2 years now

> “迷住了” means fascinated — as if the tear in his clothes was beautiful or interesting. But transfixed here means something closer to staring vacantly, the way someone might stare at nothing when they’re embarrassed, or lost in thought.

That's interesting, because as a native English speaker, that's not how I think of transfixed - which is more that something is causing you to think deeply about something. It's usual use is in religious experiences, but also when something significant is happening that causes you to stop doing what you were doing before to watch / understand / meditate on it.

"You see a man wearing simple but mostly neat clothes. He’s transfixed, however, by a ragged tear in the seam of his tunic." To me, that means he's look at the guy and trying to figure out why a guy who's wearing neat clothes (even though they are cheap) has a ragged tear in his tunic. The use of ragged is also interesting - it suggests more than that the clothing has worn out, but that he was maybe attacked by another person or animal.

I'm learning Chinese and to me, 迷 feels like it embodies an important sense of the word (but maybe only because I don't know any better translations), and I think maybe 迷惑 is the closest to the meaning from the vocabulary I currently know.

But anyway, back to the project - it's a great idea, and I really like it. When I'm watching Chinese dramas to learn, I like downloading ones that have hard-coded Chinese subs and and English .srt so I can watch with both sets at once (moving the English subs up usually so they're not on top of each other). I think it helps a lot.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: