Comment

Comment by jandrese

No seriously, the GTK C bindings are basically written in a half-formed version of the old C++ "C with preprocessor macros" syntax.

It looks like this when you program it:

    GtkWidget* grid = gtk_grid_new();
    GtkWidget* label = gtk_label_new("Hello World");
    gtk_grid_attach(GTK_GRID(grid), label, 0, 0, 1, 1);
That GTK_GRID bit is a macro that evaluates at runtime and will chuck out runtime errors if the widget doesn't match. It supports inheritance. If you have for example a gtk_combo_box_text, you can use gtk_combo_box_set_active(GTK_COMBO_BOX(my_combo_box_text), 0) and it will select the first entry in the gtk_combo_box_text because gtk_combo_box_text inherits from gtk_combo_box like any good object oriented system.
parent jandrese 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton