help-circle
rss
The C23 edition of Modern C
This new edition has been the occasion to overhaul the presentation in many places, but its main purpose is the update to the new C standard, C23. The goal was to publish this new edition of Modern C at the same time as the new C standard goes through the procedure of ISO publication. The closest approximation of the contents of the new standard in a publicly available document can be found here. New releases of major compilers already implement most of the new features that it brings.
fedilink

I've been re-learning some basic concepts of C. What next?
So far, I've followed a simple Tor interceptor tutorial on YouTube, while strictly adhering to C2x with every warning flags enabled - not that it is the optimal way to go about learning the language. I may have, or may not have inadvertently used improper C2x, but I've used `typedef` aggressively to slightly mimic Golang. Almost a year ago, I had blindly translated a C++ Vulkan tutorial to C, and I didn't understand a single thing about anything graphics-related - framebuffer, swapchain, etc. Now that I am learning it again from scratch, I also wanted to know what to learn next, as well as some of the job opportunities that I can explore.
fedilink



uLisp - A Lisp compiler to RISC-V written in Lisp
This is a simple experimental Lisp compiler, written in uLisp, that will compile a Lisp function into RISC-V machine code. You can run the compiler on the RISC-V core of a Raspberry Pi Pico 2 (or another RP2350-based board)
fedilink


Qt 6.8 Released
We are thrilled to announce the release of Qt 6.8, packed with support for new desktop, mobile, and embedded platforms, hundreds of improvements, and exciting new features to boost your development experience and meet the needs of demanding applications. For this release we have focused on improving and stabilizing existing functionality. With over 500 bug fixes and performance improvements since Qt 6.7, your existing code will run better without changing a single line. On macOS, Qt Quick applications now integrate with the native menu bar, and for a native Windows 11 look they can use the new Fluent style. Resizing Quick windows is snappier on macOS with Qt 6.8, and on Windows the application start-up time has been improved by changing the default font database to DirectWrite. Several modules that were under technology preview have been completed: Qt Graphs, Qt HttpServer, and Qt GRPC are promoted to be fully supported from this release on. Thanks to the feedback from our users we were able to finish those modules with substantial improvements since their initial introduction as technology previews.
fedilink

Segmentation fault from a supposedly valid program?
cross-posted from: https://lemmy.ml/post/21033409 > In the book authored by K.N.King, there's this example: > > ::: spoiler **viewmemory.c** > > ```c > /* Allows the user to view regions of computer memory */ > > #include <stdio.h> > #include <ctype.h> > > typedef unsigned char BYTE; > > int main(void) > { > unsigned int addr; > int i, n; > BYTE *ptr; > > printf("Address of main function: %x\n", (unsigned int) main); > printf("Address of addr variable: %x\n", (unsigned int) &addr); > printf("\nEnter a (hex) address: "); > scanf("%x", &addr); > printf("Enter number of bytes to view: "); > scanf("%d", &n); > > printf("\n"); > printf(" Address Bytes Characters\n"); > printf(" ------- ------------------------------- ----------\n"); > > ptr = (BYTE *) addr; > for (; n > 0; n -= 10) { > printf("%8X ", (unsigned int) ptr); > for (i = 0; i < 10 && i < n; i++) > printf("%.2X ", *(ptr + i)); > for (; i < 10; i++) > printf(" "); > printf(" "); > for (i = 0; i < 10 && i < n; i++) { > BYTE ch = *(ptr + i); > if (!isprint(ch)) > ch = '.'; > printf("%c", ch); > } > printf("\n"); > ptr += 10; > } > > return 0; > } > ``` > ::: > > For some reason, when I try to enter `addr` variable address as the parameter, it has a segmentation fault error. However, in the book's example and the screenshot from this [site in Hangul](https://ziegler.tistory.com/84), there's no such error? > > When I try using `gdb` to check the issue, here's what I get: > > :::spoiler gdb > ```console > $ gdb ./a.out --silent > Reading symbols from ./a.out... > (gdb) run > Starting program: /home/<username>/Desktop/c-programming-a-modern-approach/low-level-programming/a.out > [Thread debugging using libthread_db enabled] > Using host libthread_db library "/gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/lib/libthread_db.so.1". > Address of main function: 401166 > Address of addr variable: ffffd678 > > Enter a (hex) address: ffffd678 > Enter number of bytes to view: 64 > > Address Bytes Characters > ------- ------------------------------- ---------- > > Program received signal SIGSEGV, Segmentation fault. > 0x000000000040123a in main () at viewmemory.c:31 > warning: Source file is more recent than executable. > 31 printf ("%.2X ", *(ptr + i)); > (gdb) > ``` > ::: > > What is going on? By the way, I am using Guix, if that matters in any way. Here's the output for `ldd`: > > :::spoiler ldd > ```console > $ ldd ./a.out > linux-vdso.so.1 (0x00007ffecdda9000) > libgcc_s.so.1 => /gnu/store/w0i4fd8ivrpwz91a0wjwz5l0b2ralj16-gcc-11.4.0-lib/lib/libgcc_s.so.1 (0x00007fcd2627a000) > libc.so.6 => /gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/lib/libc.so.6 (0x00007fcd2609c000) > ``` > :::
fedilink

[C++] What brings an upgrade to GCC 14 from GCC 13?
Recently I wondered what I get in term of C++ features for upgrading my system from version 13 to 14 of GCC... Now, of course - a lot of bug fixes. Its surely a good idea to upgrade. But that doesn't answer my question. So a quick look at C++ compiler support showed that there is some interesting features, and mostly first C++26 support becoming available is one of them. Other features are more important to me though.
fedilink




How do modern languages deal with prototyping and modules internally?
In my journey to learning C, I've come across header files, which are used to (I'm assuming) define a prototype for the source file, as well as structure modules. This feature, in my opinion, is pointlessly not just redundant, but possibly a source for pitfall. The same information can probably be extracted from the source code, if not for the restrictions of the language specification in C. Say, if I have a GTK project, I will have to use the preprocessor directive, that will require the use of GTK headers that look something like `#include <gtk/gtk.h>`, and they're usually in the system path. How do modern languages, like Rust, Zig or Go deal with this situation, where shared libraries are used?
fedilink

Vulkan 1.3.296 Released With VK_EXT_device_generated_commands
Vulkan 1.3.296 is out as the first spec update in nearly one month. Given the time that has passed there are more bug fixes than usual but there is also a prominent new extension: VK_EXT_device_generated_commands. It has been worked on by Valve's Linux graphics driver developers along with engineers from Intel, AMD, NVIDIA, Collabora, and others. This new extension allows for the GPU device to generate a number of commands for command buffers.
fedilink

Mitosis in the Gray-Scott model : an introduction to writing shader-based chemical simulations
cross-posted from: https://lemmy.pierre-couy.fr/post/678825 Hi ! I've been working on this article for the past few days. It would mean a lot to me if you could provide some feedback. It is about implementing a physico-chemical simulation as my first attempt to write a shader. The code is surprisingly simple and short (less than 100 lines). The "Prerequisite" and "Update rules" sections, however, may need some adjustments to make them clearer. Thanks for reading
fedilink

Vector Graphics in Qt 6.8
Two-dimensional vector graphics has been quite prevalent in recent Qt release notes, and it is something we have plans to continue exploring in the releases to come. This blog takes a look at some of the options you have, as a Qt developer. In Qt 6.6 we added support for a new renderer in Qt Quick Shapes, making it possible to render smooth, anti-aliased curves without enabling multisampling. The renderer was generalized to also support text rendering in Qt 6.7, and, in the same release, Qt SVG was expanded to support a bunch of new features. And there is no end in sight yet: In Qt 6.8 we are bringing even more vector graphics goodies to the Qt APIs. In this blog, I will share some details on the different ways vector graphics can be used in Qt, as well as the benefits and drawbacks of each.
fedilink



Dependabot alternatives for non-github hosts?
I'm really bad at keeping my dependencies up-to-date manually, so dependabot was great for me. I don't use github anymore though, and I haven't really been able to find a good alternative. I found Snyk, which seems to do that, but they only allow logging in with 3rd party providers which I'm not a big fan of. Edit: seems like Snyk also only supports a few git hosts, and Codeberg isn't one of them.
fedilink