Tech News
← Home  ·  All topics

C Programming Language

7 GoKawiil briefs on this topic · RSS for c programming language

C technique uses designated initializers to simulate named, default function arguments

A blog post revisits a pattern from Ben Klemens' 2014 book 21st Century C that uses C's designated initializers, combined with a struct and macro, to let function calls take optional, named arguments with default values. The technique relies on two C-specific behaviors not adopted by C++20: initializers can appear in any order, and repeated designators simply overwrite earlier ones, with the last value taking effect.

Blogger publishes 2025 reading list for 'streetfighting' computer scientists

A blog post lays out a curated list of programming books the author considers essential, split into 'introductory streetfighting' and 'brawling combat' tiers. Recommended titles include works by Stepanov, Stroustrup, Dijkstra, Knuth, Warren, and the official Rust Programming Language book, alongside pointed dismissals of mainstream guides like Clean Code and Code Complete. The author frames the selections as texts for serious practitioners rather than casual best-of lists.

Developer argues Zig's defer eliminates C's goto-based cleanup pattern

A developer follow-up to an earlier 'Why Zig Over Rust' post examines Zig against C, noting both languages share goals of being small, garbage-collector-free, and close to the machine. The author highlights how C's common pattern of using goto for reverse-order resource cleanup on error paths is replaced in Zig by defer statements, illustrated with a user-allocation example compiled using Zig 0.17 and clang on macOS.

Musl libc and sshd flaw lets unauthenticated users gain root shell on Alpine-based systems

A vulnerability was found stemming from musl libc's crypt function returning the sentinel string "*" when a password is too long to hash, which collides with the Unix convention that "*" denotes a locked account. Because sshd hashes login attempts for locked accounts to prevent timing attacks, this collision allows an unauthenticated user to obtain a shell—potentially as root—on musl-based systems lacking PAM, such as the official Alpine AWS image.

Blog post catalogs where GCC and Clang diverge from the C standard

A technical blog post lists concrete cases where GCC and Clang do not conform to the ISO C standard by default, including treatment of the asm keyword as a reserved extension and GCC's hardcoded FLT_ROUNDS macro that ignores runtime rounding-mode changes via fesetround. The author also flags unfinished coverage of the standard's five floating-point pragmas as an area of ongoing non-conformance.

Blog post catalogs C quirks for programmers coming from Rust

A developer who learned Rust before C published a blog post listing surprising features of the C language, aimed at Rust programmers new to C. Topics include C's historically missing boolean type (added via stdbool.h in C99 and made a true primitive in C23) and its use of null-terminated strings instead of Rust's length-tracked string slices.

C's variable-size integers explained as portability feature, not flaw

An educational retrospective on teaching C explains why types like int, short, and long have no fixed bit-width in the language specification. The author recounts how sizeof(int) returned 2 bytes on old 386 machines versus 4 bytes on most modern systems, and recommends students use the stdint.h header for fixed-width types like int8_t and uint16_t when consistent sizes are required.