HNHacker News
TopNewBestAskShowJobs

enriquto

14,003 karma · joined February 11, 2016

  just another C hacker
submissionscomments
enriquto··on Good Writing
What happened to this man? A few years ago he wrote a glorious Rosetta stone of second-order functions in several programmng languages. Now he's spewing tired tropes about journalistic-style writing.
enriquto··on The Future of Flatpak
this is horrifying, and contrary to the very notion of what a "driver" should be
enriquto··on The Future of Flatpak
Just did it!

I had to add "-static" to LDFLAGS and "-lxcb -lXau -lXdmcp" to LDLIBS, for an increase in binary size from 1MB to 3MB. It's a plain X program, i guess if you use fancy toolkits it may be harder.

enriquto··on The Future of Flatpak
> How is this easy, in your experience?

add -static to your link flags? Sometimes you need to fiddle a bit with the order of the libraries, but that's it.

In the ideal case, for maximum portability, i'd like to use the αpε format!

enriquto··on The Future of Flatpak
Never understood the point of flatpak, snap and the like. Can't you just distribute static binaries? They are not that hard to compile.

(I mean, from the distributing point of view. The sandboxing and resource management is a OS-thing that should be an orthogonal issue. Users must be able to sandbox programs that they don't trust, regardless to how they are packaged and distributed.)

enriquto··on Dijkstra on Ada
maybe. But that would be so sad! (as it is with Linus)
enriquto··on Stack Overflow is almost dead
Interestingly, the site stopped growing at about the same time when the "fun killers" [0] took hand of it. Notably, when they deleted the all-time highest voting question "New programming jargon you coined?".

This blatantly undemocratic and destructive behavior was of course duely punished by the (former) users of the site.

[0] https://blog.codinghorror.com/new-programming-jargon/

enriquto··on Modern LaTeX
As a matter of principle, i prefer to use really stable software that does not change wantonly, and whose authors took the care to put it into debian.

My 20 year-old .tex documents still compile today. Will the same happen with quarto? (or typst, for that matter?) The fact that they offer no packages in the debian standard distribution signals they have likely succumbed to the awful trend of version churning, where you need to use the last version of the software or else. Thus, probably, in 20 years my documents will be un-compilable. For legacy things like typeset documents, it's reasonable to prefer legacy solutions like latex.

Once quarto and typst have stabilized enough to appear in debian stable, I'll consider them as viable alternatives.

enriquto··on Modern LaTeX

    $ sudo apt install quarto
    E: Unable to locate package quarto
yeah, hard pass
enriquto··on Can LLMs do randomness?
take b and c with opposite signs
enriquto··on Can LLMs do randomness?
> floating point operations like addition are not commutative

maybe you meant associative? Floating point addition is commutative: a+b is always equal to b+a for any values of a and b. It is not associative, though: a+(b+c) is in general different to (a+b)+c, think what happens if a is tiny and b,c are huge, for example.

enriquto··on Is it possible to write plain C iOS app in 2025?
There is this beautiful single-header library to write simple graphical programs in C, portably to standard unixes, macos, and windows:

https://github.com/ColleagueRiley/RGFW.git

It was discussed recently around here: https://news.ycombinator.com/item?id=42217535

The macos backend is a neat hack, written in pure C.

enriquto··on Simple Web Server

    mini_httpd -p 8080   # and no need to install a whole python interpreter
enriquto··on Open-Source Is Just That
if it's your software you can simply sell them a proprietary license separately
enriquto··on Jumping Spiders
> The second and third books leave something to be desired

Also got this feeling on the first read... but now I remember them very fondly! I like to think that this trilogy happens in the same universe as Dune, being a prequel to the events of Dune. The homage to the Dune universe by the author is obvious (the names of the books, the notion of "other memories", etc). But many notions fit together, with some effort in your imagination. The second book of the trilogy provides a mechanism to explain the other memories in the form of nodal biology. The octopi ftl technique is reminiscent of the guild navigators. The third book hints subtly at a reason why the butlerian jihad could have happened.

enriquto··on Don't Be Afraid of Types
Sorry man, I was just trying to spew some harmless banter.
enriquto··on Don't Be Afraid of Types
> And your saying "everything is a word" for assembler is just plain wrong.

I also love x87 registers, but they are becoming rarer these days.

enriquto··on Don't Be Afraid of Types
As somebody who is afraid of types (and also, who hates types, because we all hate what we fear), may my point of view serve as balance: you don't need a type system if everything is of the same type. Programming in a type-less style is an exhilarating and liberating experience:

assembler : everything is a word

C : everything is an array of bytes

fortran/APL/matlab/octave : everything is a multi-dimensional array of floats

lua : everything is a table

tcl : everything is a string

unix : everything is a file

In some of these languages there are other types, OK, but it helps to treat these objects as awkward deviations from the appropriate thing, and to feel a bit guilty when you use them (e.g., strings in fortran).

enriquto··on The Pain That Is GitHub Actions
you can put them in the same repository, if that is your thing.

If you put the build files in a .builds/ folder at the root of your repository, they will be run upon each commit. Just like in github or gitlab. You are just not forced into this way of life.

If you prefer, you can store the build files separately, and run them independently of your commits. Moreover, the build files don't need to be associated to any repository, inside or outside sourcehut.

enriquto··on Lemma for the Fundamental Theorem of Galois Theory
I rarely ^U nowadays, but your site was so clean that I couldn't resist!

Just as a side note : when writing html5 by hand, you can use the full power of the language, most notably optional tags (no need to write html, body, etc) and auto-closing tags (no need to close p, li, td, etc). You may get something even crispier!

See for a reference the google html style guide : https://google.github.io/styleguide/htmlcssguide.html#Option...

And the official html5 reference for a complete list of optional tags : https://html.spec.whatwg.org/multipage/syntax.html#syntax-ta...

enriquto··on Lemma for the Fundamental Theorem of Galois Theory
The html source is beautiful, did you write it by hand?
enriquto··on I stopped everything and started writing C again
Ackshually, it has nothing to do with the C language. It's an implementation choice by some compilers. A conforming implementation could give you the whole RAM and swap to your stack.
enriquto··on I stopped everything and started writing C again
Hahaha! I'll start calling Rust "Zoomer Ada"
enriquto··on Fastplotlib: GPU-accelerated, fast, and interactive plotting library
Ultimately, objects are always drawn in the screen by setting pixels into it. Plotting a point by setting a pixel is entirely reasonable, and can be indeed done directly, in realtime, for several millions of points. I just tested the C program below, compiled with gcc without optimizations, and it gives about 80 fps for three million points (on my 6 year-old thinkpad). My point: CPUs are ridiculously fast, and you can indeed do a lot of large-scale data visualization without need to meddle with the GPU.

    #define FPS 80

    void plot_points(
                    float *o,  // output raster array (w*h)
                    int w,     // width of raster
                    int h,     // height of raster
                    float *x,  // input point coordinates (2*n)
                    int n      // number of input points
                    )
    {
            // initialize the output raster
            for (int i = 0; i < 2*w*h; i++)
                    o[i] = 0;
    
            // accumulate the points that fall inside the raster
            for (int i = 0; i < n; i++)
            {
                    int p = x[2*i+0];
                    int q = x[2*i+1];
                    if (p >= 0 && p < w && q >= 0 && q < h)
                            o[w*q+p] += 1;
            }
    }
    
    #include <stdlib.h>
    int main(void)
    {
            int w = 1000;
            int h = 1000;
            int n = 3000000;
            float *x = malloc(2*n*sizeof*x);
            float *o = malloc(w*h*sizeof*o);
            for (int i = 0; i < 2*n; i++)
                    x[i] = 1000*(rand()/(1.0+RAND_MAX));
            for (int i = 0; i < FPS ; i++)
                    plot_points(o, w, h, x, n);
            return 0;
    }
    // NOTE: if this program runs in less than 1 second, it means that it
    // is faster than "FPS"
enriquto··on Fastplotlib: GPU-accelerated, fast, and interactive plotting library
Of course you can! The screen of my laptop has nearly 3 million points (2160x1350) and I can do a fair amount of processing on each of its pixels, with one CPU thread, and still be above 30fps. A naive plotting method that loops over all the points and puts them into a grid will work without problem. Try it yourself!
enriquto··on I stopped everything and started writing C again
In theory, this is a compiler implementation detail. The compiler may chose to put large stacks in the heap, or to not even use a stack/heap system at all. The semantics of the language are independent of that.

In practice, stack sizes used to be quite limited and system-dependent. A modern linux system will give you several megabites of stack by default (128MB in my case, just checked in my linux mint 22 wilma). You can check it using "ulimit -all", and you can change it for your child processes using "ulimit -s SIZE_IN_KB". This is useful for your personal usage, but may pose problems when distributing your program, as you'll need to set the environment where your program runs, which may be difficult or impossible. There's no ergonomical way to do that from inside your C program, that I know of.

enriquto··on Peer-to-peer file transfers in the browser
kids these days...

in my time, we used to know each other's IP addresses and just used netcat

enriquto··on I stopped everything and started writing C again
> Try doing C with a garbage collector ... it's very liberating.

> Do `#include <gc.h>` then just use `GC_malloc()` instead of `malloc()` and never free.

Even more liberating (and dangerous!): do not even malloc, just use variable length-arrays:

    void f(float *y, float *x, int n)
    {
            float t[n];  // temporary array, destroyed at the end of scope
            ...
    }
This style forces you to alloc the memory at the outermost scope where it is visible, which is a nice thing in itself (even if you use malloc).
enriquto··on First official release of LLVM Flang
it's a fairly common usage in numeric computing. If you read, for example, the wikipedia entries for "computational fluid dynamics" you'll see that they consistently speak of "codes" when referring to programs.

https://en.wikipedia.org/wiki/Computational_fluid_dynamics

enriquto··on Fastplotlib: GPU-accelerated, fast, and interactive plotting library
But why do you want to fit the whole dataset in memory? If the dataset is stored in a tiled and multi-scaled representation you need to only grab the part of it that is needed to fit your screen (which is a constant, small amount of data, even if the dataset is arbitrarily large).

If you insist to fit the entire thing in memory, it may seem better to do so in the plain RAM, which nowadays is of humongous size even in "modest" systems.

← PreviousPage 4 of 34Next →