Ethan McCue: Issues you will face binding to C from Java.
Ethan McCue: Issues you will face binding to C from Java.
I like to think of Arch Linux in the same way the C programming language gives you the freedom to royally screw things up if you don't know what you're doing, and NixOS in the same way that the Rust programming language provides safety to prevent you from easily making stupid mistakes.
I've been #programming in the #CLanguage since 1989. #TIL you CAN return memory obtained by alloca() without terminating the function. Just give it a size that is two's complement negative: alloca(-40) to give back 40 bytes. That becomes SIZE_MAX - 40, whose wraparound arithmetic will move the stack pointer in the direction toward the stack bottom.
Usual disclaimers apply: it's nonstandard and compiler/platform dependent. Maybe some allocas guard against that and blow up.
It's interesting comparing Usenet of 1993 to Hacker News of today. Some questions are perennial, it seems:
"But what use is malloc(0)?" followed by a discussion of people rolling their own Pascal-like strings.
"Why unique?" followed by a discussion of making sets and maps.
"It's not a valid pointer." leading to the usual pantomime rejoinder.
I haven't seen anyone ask what the old implementations that returned NULL did to errno, though.
Recuperiamo un mio vecchio programma del 1993 per MS-DOS realizzato con il Turbo C++ della Borland: il classico insieme di Mandelbrot in grafica VGA a 16 colori. Questa volta per il recupero ho usato i dischetti originali. #clanguage #programming #borland #mandelbrot https://www.youtube.com/watch?v=Bp5h-AMeRfQ
Back in 1993, #AIX was the example that people gave of a C library where malloc(0) returned NULL.
https://groups.google.com/g/comp.unix.aix/c/lstmVEcmD2Q/m/wRsWt_Tnw1UJ
Most of the C libraries that I touched back then either just handed off to the operating system's API for suballocation, which did not treat zero specially, or had their own suballocation functions, which did not treat zero specially.
GCC 15.1 Released With COBOL Compiler & Many Other Improvements
At last someone has articulated my thoughts about C memory safety. The solution exists and is very robust: ADA.
If only I could convince management to use that instead of C/C++. Instead they're more likely to find Rust the more attractive option
https://hackaday.com/2025/03/11/trapc-a-c-extension-for-the-memory-safety-boogeyman/
Curl's Daniel Stenberg on Securing 180,000 Lines of C Code
https://thenewstack.io/curls-daniel-stenberg-on-securing-180000-lines-of-c-code/
We love PostgreSQL for its resiliency, performance, extensibility, and flexibility in adapting to just about any use case. So, we celebrate Postgres today just like every day and wish you, the users (whether long-standing or brand new!) and the community a very happy Valentine’s Day. May you always experience PostgreSQL as being a database you love, too.
Photo credit: Getty Images on Unsplash
Ceedling 1.0 was released on the 1st of January. I only saw it today, looking forward to introducing it into my workplace. Https://github.com/ThrowTheSwitch/ceedling
#testing #clanguage #embedded
Can any #clanguage people give me some suggestions? In my current project, I have a `StringView` struct, which is essentially a pointer and a length. Every time when I need to print it, I need to do something like
```c
printf("%*s", (int)sv.size, sv.start);
```
This is annoying and error-prone. I can also write custom format-print functions, which will also allow me to format-print arbitrary structs. However, then I lose the nice compiler protection against incorrect formats.
pthread_cancel considered harmful
https://skaark.wordpress.com/2010/08/26/pthread_cancel-considered-harmful/ #c #clanguage #programming #linux #posix
Why so many people hate C?
Because the C language assumes you know what you’re doing and lets you. If you don't know what you are doing you can learn or you can hate the language.
I realize that -- these days -- shitting on C is pretty much a cottage industry for some people. It does a lot of things wrong by modern standards, no argument from me. That's absolutely a true statement.
But if you had been around back then, with the hardware we had, and seen the language alternatives, you'd realize why it sparked joy for so many people.
El 12 de octubre de 2011, fallece Dennis Ritchie, científico computacional estadounidense, creador del lenguaje C, y cocreador junto a su colega de toda la vida, Ken Thompson, del SO Unix y el lenguaje B. lamentablemente sufría del corazón y de un cáncer protático avanzado. Falleció a los 70 años y su noticia fue opacada porque una semana antes había fallecido Steve Jobs a quien los medios dieron más difusión
#retrocomputingmx #dennisritchie #unix #clanguage
I saw a fun C programming problem, probably freshman homework: determine if a string is a "pangram" (see https://en.wikipedia.org/wiki/Pangram ). It's similar to exercise 1-14 in K&R: make a histogram of input characters.
Here's my (hopefully non-freshman) solution which accepts input from pipe/redirect, or command line arguments, or console input: https://github.com/ednl/c/blob/master/pangram.c
Rust in Linux lead retires rather than deal with more “nontechnical nonsense” - Enlarge / Rust never sleeps. But Rust, the programming language, can be... - https://arstechnica.com/?p=2046763 #wedsonalmeidafilho #kerneldevelopment #linustorvalds #rustlanguage #linuxkernel #asahilinux #asahilina #clanguage #biz #linux #tech #rust
I am sensing that someone tested errno >= 0 in some code. (-:
If you're writing C code for the new Raspberry Pi Pico 2 you might find something useful in this little collection of libraries I've worked on: https://github.com/TuriSc/Raspberry-Pi-Pico-Libraries