#Define

犬とハイネ🦋🩵💚naota344@social.mikutter.hachune.net
2026-02-24

Linux kernle, "#define auto __auto_type"して、auto型の適用がひろがりそりんぐがある。

Re: Clarifying confusion of our variable placement rules caused by cleanup.h - Linus Torvalds
lore.kernel.org/all/CAHk-=wiCO

Claudio Piresclaudiocamposp
2026-02-23
Joe Groff󠄱󠄾󠅄󠄸󠅂󠄿󠅀󠄹󠄳󠅏joe@f.duriansoftware.com
2026-02-22

@floooh @vitaut @thradams until C23, true and false were just stdlib defines

#define bool _Bool
#define true 1
#define false 0

Joe Groff󠄱󠄾󠅄󠄸󠅂󠄿󠅀󠄹󠄳󠅏joe@f.duriansoftware.com
2026-02-22

@floooh @vitaut @thradams if you’re compiling as standard C99 or C11, it is “right” for true and false to be ints, since they are specified to be #define-d as 1 and 0 in stdbool.h

2026-02-22

// Ascend
#define V(c)d=min(d,0.),k+=a=d*k-d,o+=a*exp(-s*1.3)*(c+c*d)
#define N(x,y)abs(dot(sin(p/a*x),p-p+a*y))
void main(){vec3 o,p,q;for(float i,d,a,l,k,s,x;i++<1e2;V(mix(vec3(0,1.5,3),q=vec3(3,1,.7),x=max(2.-l,0.)*.8)),d=l,V(q*20.),o+=(x-x*k)/s/4e2)for(p=normalize(vec3(P+P-R,R.y))*i*.05,p.z-=3.,s=length(q=p-vec3(1.5,.7,0)),q.y=p.y-min(p.y,.7),l=length(q),p.y+=T,d=min(length(p.xz),1.-p.z),a=.01;a<3.;a+=a)p.zy*=.1*mat2(8,6,-6,8),d-=N(4.,.2),l-=N(5.,.01);O=vec4(tanh(o),1);}
#shader #demo #art

2026-02-21

Canvas_ity: A tiny, single-header <canvas>-like 2D rasterizer for C++
----
- 39 minutes ago | 3 points | 0 comments
- URL: github.com/a-e-k/canvas_ity
- Discussions: news.ycombinator.com/item?id=4
- Summary: canvas_ity is a tiny, single-header C++ library for rasterizing immediate-mode 2D vector graphics, modeled on the W3C HTML5 2D canvas specification. Prioritizing high-quality rendering, ease of use, and compact size over raw speed, it provides nearly full spec compliance except for hit regions.

Key features include trapezoidal area antialiasing, gamma-correct blending and resampling, bicubic image interpolation, ordered dithering, and careful handling of high-curvature line joins. The library is provided as a single header with no dependencies beyond the standard C++ library, requiring only a `#define CANVAS_ITY_IMPLEMENTATION` in one source file. It uses no global state, allocates no dynamic memory after initialization, and works with exceptions/RTTI disabled.

At approximately 2,300 lines and under 36 KiB compiled, it achieves 100% test coverage. Limitations include basic text rendering (no kerning or shaping), font parsing not secure for untrusted inputs, single-threaded CPU-only rendering, and antialiased clipping masks rather than geometric intersection. Usage requires manual buffer management for I/O. Licensed under ISC. The author notes this is a read-only mirror and does not accept pull requests.

2026-02-20

@max I think the closest to a macro I ever did was

#define

In C. And there it doesn't matter what a thing is, or if the variable actually exists.

So it took me some time to understand the logic behind the rust macro expansion. And it seems that LLMs should learn this sometimes, too...

2026-02-20

@thing If you haven't included <unistd.h>, do that. But assuming you have included <unistd.h>:

The man page (man7.org/linux/man-pages/man2/) indicates that it requires _GNU_SOURCE to be defined, because it's not a standard POSIX function. You can either compile with -D_GNU_SOURCE, or #define _GNU_SOURCE before including unistd.h, or compile with -std=gnu++20 or something.

I would probably go with '#define _GNU_SOURCE' at the top of the file

The Liquid Clear (Bree D)liquid_clear
2026-02-20

that doesn't exist

I can do fun things with mail.

# unerwünschte Werbung
:0
* ^X-local-part-suffix: kris-macheist
{
EXITCODE=67

:0 i
$BOUNCELOG/
}

What is that Six-Seven there?

/usr/include/sysexits.h:#define EX_NOUSER       67      /* addressee unknown */

It is a user-unknown bounce, and a local copy.

2026-02-17

[Перевод] Как Майкл Абраш удвоил скорость Quake

Вместе с релизом в 1999 году исходного кода Quake был выпущен файл readme.txt , написанный Джоном Кармаком. Особый интерес в нём вызвало одно предложение: Также для сборки файлов на языке ассемблера требуется Masm. Можно изменить #define и выполнять сборку только с кодом на C, но версии с программным рендерингом при этом потеряют почти половину скорости. Quake был вдвое быстрее благодаря написанному вручную ассемблерному коду? Давайте разберёмся, так ли это, как это работает, и какими были самые важные оптимизации.

habr.com/ru/articles/1000200/?

#quake #майкл_абраш #michael_abrash #оптимизации_кода

2026-02-17

[Перевод] Как Майкл Абраш удвоил скорость Quake

Вместе с релизом в 1999 году исходного кода Quake был выпущен файл readme.txt , написанный Джоном Кармаком. Особый интерес в нём вызвало одно предложение: Также для сборки файлов на языке ассемблера требуется Masm. Можно изменить #define и выполнять сборку только с кодом на C, но версии с программным рендерингом при этом потеряют почти половину скорости. Quake был вдвое быстрее благодаря написанному вручную ассемблерному коду? Давайте разберёмся, так ли это, как это работает, и какими были самые важные оптимизации.

habr.com/ru/articles/1000200/

#quake #майкл_абраш #michael_abrash #оптимизации_кода

2026-02-17

@soatok

I have a nitpick about C in general, because people say "this won't be used in release builds" all the time but this doesn't appear to be a feature of C itself.

  • Did you know that, in release builds, assert() is a NOP?

As far as I can tell C doesn't have a direct concept of release builds, that behaviour comes down to whether someone calls #define NDEBUG. I cannot find NDEBUG in the codebase, and most apps define "release build" by whether they add -g or -O3.

2026-02-16

today's hack of the day:

#define DEREF_MISALIGNED(src) ({typeof(*(src)) dst; memcpy(&dst, (void*)(src), sizeof(dst)); dst;})

ポイズン雷花poison_raika
2026-02-15

防御型空母て何? What is a defensive aircraft carrier?
防御型空母。日本では空母保有を巡って、議論が、一応''なさられてる''一応。
Defensive aircraft carrier. In Japan, there is some discussion about having an aircraft carrier.

pixiv.net/novel/show.php?id=20

2026-02-14

abdimoallim/vdb: A header-only C vector database library

💥 Check out this trending post from Hacker News 📖 📂 **Category**: 📌 **What You’ll Learn**: A lightweight, header-only C library for storing and searching high-dimensional vector embeddings with optional multithreading support. Header-only implementation (single file: vdb.h) Multiple distance metrics (cosine, euclidean, dot product) Optional thread-safe operations via VDB_MULTITHREADED Save/load database…

viralpique.com/abdimoallim-vdb

2026-02-14

定数の宣言に #define xxxx 0x1234;
と;を付けるんじゃねええええええええええええええええええ💢

2026-02-13

@jrose @wingo the post does contain:
```
static_inline \
static inline __attribute__((always_inline))
```
It just conflates the different parts of that a bit in the prose.

Ed Masteemaste
2026-02-12

~/src/linux $ gmake LLVM=1 ARCH=x86_64
HOSTCC arch/x86/tools/relocs_32.o
arch/x86/tools/relocs_32.c:11:9: error: 'ELF_CLASS' macro redefined [-Werror,-Wmacro-redefined]
11 | ELF_CLASS ELFCLASS32
| ^
/usr/include/sys/elf_generic.h:43:9: note: previous definition is here
43 | ELF_CLASS __CONCAT(ELFCLASS,__ELF_WORD_SIZE)
| ^

2026-02-10

I wonder if #RustLang chose its #[name] attribute syntax precisely to avoid Rust snippets accidentally becoming hashtags on social media.

Unlike, for example, C. #include and #define and #ifdef are lost causes as hashtags unless you _wanted_ to use them as a way to find inline C snippets in toots!

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst