Post Ad5txTkEOAFIlMZ4Mq by alexandria@anarchism.space
 (DIR) More posts by alexandria@anarchism.space
 (DIR) Post #Ad5txLHDs8HwV4vn2e by alexandria@anarchism.space
       2023-12-23T07:20:54Z
       
       0 likes, 0 repeats
       
       wanna see some bad code
       
 (DIR) Post #Ad5txPdLfoMc0rJW5I by alexandria@anarchism.space
       2023-12-23T07:21:02Z
       
       0 likes, 0 repeats
       
       of course u do
       
 (DIR) Post #Ad5txQKx3hF4C5iL32 by alexandria@anarchism.space
       2023-12-23T07:22:11Z
       
       1 likes, 0 repeats
       
       I found this in a repo which i will not name
       
 (DIR) Post #Ad5txTkEOAFIlMZ4Mq by alexandria@anarchism.space
       2023-12-23T07:24:04Z
       
       0 likes, 0 repeats
       
       Some notes. FALSE and TRUE should be imported from stdbool.h. or you can simply use the idioms for them, because thats what c programmers are used to ??? (and which they uh, also do. lmao. theres no extra clarity here lol)MAX_PATH is gruesomely wrong when u take into account NixOS with hashes as filenames and the possibility of network stores. the default for PATH_MAX in linux is in most kernels, 4096 lmao. also its plain wrong for windows _too_ because of \\?\ prefixing
       
 (DIR) Post #Ad5txdVM6KHx27gKZM by alexandria@anarchism.space
       2023-12-23T07:25:30Z
       
       0 likes, 0 repeats
       
       WCHAR is wrong because it's a _wide char_ which is wchar_t (from stdint.h i think? idr). that's supposed to be an int16 not an int8. BUT. That doesn't matter because the keen eyed will have noticed something weird -- why do they define Os_Windows ?
       
 (DIR) Post #Ad5txfCzlYn4Jl6hEG by alexandria@anarchism.space
       2023-12-23T07:28:11Z
       
       0 likes, 0 repeats
       
       You see, the reason they're defining WCHAR, which _is not used in the unix code_ is because they're using an if() to differentiate between unix and windows...so the compiler is trying to pack both branches into the same binary and going "oh shit these things are undefined!!!" for a branch that would never execute. The better solution here would be to:A) separate files that contain subroutines that are #ifdef'd for linux/windowsB) bite the bullet and use #ifdef
       
 (DIR) Post #Ad5txh1134OdvBW9po by alexandria@anarchism.space
       2023-12-23T07:29:39Z
       
       0 likes, 0 repeats
       
       (It's not a HUGE sin because the compiler will optimize those branches out, but it's a mess of definitions for a multi-file C project like this one. oh yeah, this is multi-file by the way)