Readit News logoReadit News
kazinator commented on Why is the sky blue?   explainers.blog/posts/why... · Posted by u/udit99
kazinator · 3 minutes ago
[delayed]
kazinator commented on Thoughts on Generating C   wingolog.org/archives/202... · Posted by u/ingve
gopalv · 2 hours ago
If you have ever used something like yacc/bison, debugging it is relatively sane with gdb.

You can find all the possible tricks in making it debuggable by reading the y.tab.c

Including all the corner cases for odd compilers.

Re2c is a bit more modern if you don't need all the history of yacc.

kazinator · 12 minutes ago
Debugging Yacc is completely insane with gdb, for other reasons, like that grammar rules aren't functions you can just put a breakpoint on, and see their backtrace, etc, as you can with a recursive descent parser.

But yes, you can put a line-oriented breakpoint on your action code and step through it.

kazinator commented on Thoughts on Generating C   wingolog.org/archives/202... · Posted by u/ingve
20k · an hour ago
Static inline functions can sometimes serve as an optimisation barrier to compilers. Its very annoying. I've run into a lot of cases when targeting C as a compilation target where swapping something out into an always-inline function results in worse code generation, because compilers have bugs sadly

There's also the issue in that the following two things don't have the same semantics in C:

    float v = a * b + c;
vs

    static_inline float get_thing(float a, float b) {
        return a*b;
    }

    float v = get_thing(a, b) + c;
This is just a C-ism (floating point contraction) that can make extracting things into always inlined functions still be a big net performance negative. The C spec mandates it sadly!

uintptr_t's don't actually have the same semantics as pointers either. Eg if you write:

    void my_func(strong_type1* a, strong_type2* b);
a =/= b, and we can pull the underlying type out. However, if you write:

    void my_func(some_type_that_has_a_uintptr_t1 ap, some_type_that_has_a_uintptr_t2 bp) {
        float* a = get(ap);
        float* b = get(bp);
    }
a could equal b. Semantically the uintptr_t version doesn't provide any aliasing semantics. Which may or may not be what you want depending on your higher level language semantics, but its worth keeping the distinction in mind because the compiler won't be able to optimise as well

kazinator · 13 minutes ago
The inline function receives the operands as arguments, and so whatever they are, they get converted to float. Thus the inline code is effectively like this:

  float v = (float) ((float) a) * ((float) b) + c;
Since v is float, the cast representing the return conversion can be omitted:

  float v = ((float) a) * ((float) b) + c;
Now, if a and b are already float, then it's equivalent. Otherwise not; if they are double or int, we get double or int multiplication in the original open code.

kazinator commented on Thoughts on Generating C   wingolog.org/archives/202... · Posted by u/ingve
kazinator · 21 minutes ago
Generators don't have to put out portable code. You document what compilers are required for the output and that's something you can change with any given release of your generator. Then the generated code uses whatever works with those compilers. If you use the output with some other compiler, then that's undefined behavior w.r.t. the documentation of the generator; you are on your own. "Whatever works" could be something undocumented that works de facto.
kazinator commented on Evolution of car door handles over the decades   newatlas.com/automotive/e... · Posted by u/andsoitis
mrgoldenbrown · 2 days ago
The main purpose of a handle is to open a door, not look polished. Looking polished is not helpful when you're dead because you couldn't get out of that car in an emergency . So IMHO it shouldn't be surprising that they're being banned.
kazinator · 2 days ago
There are obvious ways to design a door handle which looks exactly the same, but isn't electronic.
kazinator commented on LLMs as the new high level language   federicopereiro.com/llm-h... · Posted by u/swah
kazinator · 2 days ago
This is a good summary of any random week's worth of AI shilling from your LinkedIn feed, that you can't get rid of.
kazinator commented on British drivers over 70 to face eye tests every three years   bbc.com/news/articles/c20... · Posted by u/bookofjoe
matsemann · 2 days ago
That's not a good counter. I think you need to look at how many of that demographic actually drives, not how big the demographic is. Or maybe kilometers driven per accident.
kazinator · 2 days ago
That onus is on the article: convince me that almost a quarter of the facilities being 70+ means something (s not explained by statistics but follows age).
kazinator commented on British drivers over 70 to face eye tests every three years   bbc.com/news/articles/c20... · Posted by u/bookofjoe
kazinator · 2 days ago
Let's examine this:

> Nearly one in four car drivers killed in 2024 were aged 70 or older, according to government figures.

So, somewhat less than 25%. Let's guess 23% or whatever.

What are the age demographics? According to 2024 stats, 19.7% of the UK was aged 65 or older. 17% in the 0-14 age range.

Thus 65-year-olds and older make up 23.7% of the population older than 14.

It seems, roughly, as if the proportion of 70-year-olds and older might be more or less in line with their representation in the driving age population.

It's not the statistics we need, but close enough to defeat the alarmist idea of OMG, a whopping quarter (almost) fatalities are 70+; get the old buggers off the roads!

kazinator commented on I now assume that all ads on Apple news are scams   kirkville.com/i-now-assum... · Posted by u/cdrnsf
kazinator · 2 days ago
That engine mug is a kind of half-scam. The images look as if it might be cast metal (like pewter), but most of the body is just painted resin. It does have the 3D shape depicted It's not as egregious a deception buying what obviously looks like a knit sweater and receiving a cotton T with a digital print.
kazinator commented on A century of hair samples proves leaded gas ban worked   arstechnica.com/science/2... · Posted by u/jnord
adrianN · 3 days ago
It’s probably a bit late for that. BEV will have taken the market four new cars before such a campaign could take root.
kazinator · 3 days ago
We should be using leaded solder though! Campaign away ...

u/kazinator

KarmaCake day34311July 2, 2014
About
Working on the TXR language: https://nongnu.org/txr

Want to talk to me? Drop me an e-mail:

125-888-0378@kylheku.com

This could change without notice; check the profile.

Git repositories: https://www.kylheku.com/cgit

Mastodon: @Kazinator@mstdn.ca

LinkedIn: https://www.linkedin.com/in/kaz-kylheku-8a8b94197/

meet.hn/city/49.2608724,-123.113952/Vancouver

Socials: - kazinator.at.hn

---

View Original