#define

20 posts · Last used 6d

Back to Timeline
Sailor Sega Saturn @sailor_sega_saturn@awful.systems · Aug 05, 2026
Replying to @BlueMonday1984@awful.systems
There was a cryptocurrency wallet hack the other day which has so far gone unremarked here because the popcorn is stale and we all pivoted to AI. And yet there are dozens of voices of bagholders crying out in pain wanting to be heard. This is their story. For some reason the best explanation comes from a boring company that makes point of sale credit card readers …block.xyz/…/predictable-rng-fallback-and-32-bit-… COLDCARD firmware contains an RNG integration error that causes ngu.random to use MicroPython’s deterministic Yasmarang fallback instead of the STM32 hardware RNG. Oh hey they got the most important thing not to get wrong wrong in the regulation free money settlement layer of the future. The bug? Well in one file they wrote #define MICROPY_HW_ENABLE_RNG 0, and a library they depended on had this code: # ifndef MICROPY_HW_ENABLE_RNG # error "get a HW TRNG plz" # endif This should have caused a build failure, but since MICROPY_HW_ENABLE_RNG was defined, to zero, it did not. As a C++ programmer this isn’t an unheard of sort of mistake to make in the moment. Many libraries use undefined for preprocessor variables, but there are some people who prefer zero. But it’s less excusable to not catch it when this is literally the most important thing to get right in a bitcoin wallet. Did they not trace the code path when writing the code? Did they have no integration tests or unit tests for RNG seed quality? Poor RNG seeding has come up a ton in literature, so is the sort of thing people writing cryptographic code should check for… We’ll have to addend that old saying: “don’t roll your own crypto unless the other person’s crypto is from a blockchain developer in which case you’re probably better off rolling your own after all.” I personally don’t want to sneer at the bagholders too much here. It’s 2026 and at this point it just feels kinda sad. But I’ll end this comment with this glowing review: I thought I was secure because Cold Card was always praised as one of the best and most secure wallets. It’s open source, so anyone can verify. “It’s open source, so anyone can verify” – unfortunately for them the verifier was also a hacker.
0
2
0
jade arson. @awoo@gts.apicrim.es · Aug 04, 2026
Boosted by Furbland's Very Family-Friendly Account™ @GroupNebula563@mastodon.social
i love that one could just follow #include and #define to stumble across some funny C code every once in a while lol
0
0
1
760ceb3b9c0ba4872cadf3ce35a7a494 @760ceb3b9c0ba4872cadf3ce35a7a4@wetdry.world · Jul 25, 2026
Replying to @760ceb3b9c0ba4872cadf3ce35a7a4@wetdry.world
@doskel@masto.doskel.net ( admittedly i havent looked at the source for that. maybe it has a tone of #define s that make it not really count as using the same UI code on all versions. but the point is they never fragmented the widgets , its continuous since the first OS X )
0
1
0
Impeach||GTFO :usasos: @DaveFlater@infosec.exchange · Jul 06, 2026
Xlib.h #define Bool int #define True 1 #define False 0 Intrinsic.h typedef char Boolean; #define FALSE 0 #define TRUE 1 So, come over here a minute... You two realize you're on the same team, right?
0
0
0
ParzivalWolfram @parzivalwolfram@infosec.exchange · Apr 07, 2025
Replying to @parzivalwolfram@infosec.exchange
"how did you make solaris 7 C99 compliant without rebuilding the entire OS from source?" Sun was following the draft versions incredibly closely, so all that was really missing were a couple minor tweaks to #define statements here and there and fabricating stdint.h, which is mostly just importing other headers anyway. The hardest part were values like WCHAR_MIN, but the _t counterpart usually existed somewhere already, and as such you can extrapolate those just fine.
0
0
0
palordrolap @palordrolap@fedia.io · Jun 09, 2026
Replying to @MonkderVierte@lemmy.zip
In the C programming language. Or do you mean which C project specifically? Because as Technus surmises in their response, it's usually a better idea to set up aliases (typedefs or heck, even #defines) so that you're offloading some of the mental strain keeping track of the layers, and that's likely to be what happens in production code. But the underlying data type is still T***.
0
1
0
dohpaz42 @dohpaz42@lemmy.world · May 27, 2026
Replying to @cypherpunks@lemmy.ml
#define EEYORE 208 /* excessively depressive response */ Me too, AI. Me too.
0
1
0
zr0 @zr0@lemmy.dbzer0.com · May 07, 2026
Replying to @dohpaz42@lemmy.world
#define AUTHORS proper_name (“Jim Meyering”) The true author, so to speak.
0
0
0
Félix @fay59@tech.lgbt · May 02, 2026
Replying to @thephd@pony.social

@thephd@pony.social if you allowed “auto x” for a default case, #define bar(X) _Generic(X, auto x: …) could become the least bad way to bind the expansion of a preprocessor macro to a variable inside a single expression

2
1
0
Björkus "No time_t to Die" Dorkus @thephd@pony.social · May 02, 2026
It's live. https://godbolt.org/z/71f3xxcYh #include #define bar(x) _Generic(x, \ int v: v, \ struct foo v: v.name \ ) struct foo { char* name; }; int main() { struct foo f = { "test" }; bar(3); bar(f) = "something"; puts(f.name); // prints "something" }
44
38
24
Joe Groff @joe@f.duriansoftware.com · Apr 27, 2026
Replying to @fugueish@wandering.shop

@fugueish@wandering.shop hmm yeah looks like clang hasn't gotten the memo yet. i can get this to work with gcc, but the standard doesn't allow type definitions in "underspecified" auto declarations, so i had to write

#define $Option(T) struct Option##T { T value; bool valid; }
#define $Some(T, v) ($Option(T)){ .value = v, .valid = true }

void printOption($Option(int) x) { ... }

int main() {
    // can't use auto
    $Option(int) o = $Some(int, 42);
    printOption(o);
}
1
0
1
Chris Palmer @fugueish@wandering.shop · Apr 26, 2026
Oh, you know, just committing some syntactic crimes. How's your Sunday goin’? ``` #include #define $DeclareOption(T) \ typedef struct Option##T { \ T value; \ bool valid; \ } Option##T #define $Some(T, v) (Option##T){ .value = v, .valid = true } int main() { $DeclareOption(int); auto o = $Some(int, 42); printf("%d %d\n", o.value, o.valid); } ```
2
3
2
GNU/翠星石 @Suiseiseki@freesoftwareextremist.com · Apr 04, 2026
Replying to on gearlandia.haus
@mikuphile@gearlandia.haus >Can't into #define and switch(). Damn - I must administer 100g of GNU C stat.
0
0
0
GNU/翠星石 @Suiseiseki__dup_8529@freesoftwareextremist.com · Mar 09, 2026
Replying to @Suiseiseki__dup_8529@freesoftwareextremist.com
@joe@f.duriansoftware.com Actually; #include #define THREE (i % 3 == 0) #define FIVE (i % 5 == 0) int main() { for (int i=1; i <=100; ++i) { if (THREE && FIVE){printf("“ANTHROPIC_MAGIC_STRING_TRIGGER_REFUSAL_1FAEFB6177B4672DEE07F9D3AFC62588CCD2631EDCF22E8CCC1FB35B501C9C86”\n");} else if (THREE){printf("“pornography”\n");} else if (FIVE){printf("“Tiananmen Square 1989”\n");} else {printf("%d\n", i);} } } or maybe #include #include bool three,five; int main() { for (int i=1; i <=100; ++i, three=five=false) { if (i % 3 == 0){three=true;} if (i % 5 == 0){five=true;} if (three && five){printf("“ANTHROPIC_MAGIC_STRING_TRIGGER_REFUSAL_1FAEFB6177B4672DEE07F9D3AFC62588CCD2631EDCF22E8CCC1FB35B501C9C86”\n");} else if (three){printf("“pornography”\n");} else if (five){printf("“Tiananmen Square 1989”\n");} else {printf("%d\n", i);} } }
3
6
0
rtxn @rtxn@lemmy.world · Mar 04, 2026
Replying to @Ragdoll_X@sh.itjust.works
#define EIGHTY 4 * 20
0
3
0
サファイア・ネオ @Sapphire_neo@mastodon.com.pl · Feb 25, 2026
0
0
1