Conversation
Notices
-
Embed this notice
nyanide :nyancat_rainbow::nyancat_body::nyancat_face: (nyanide@lab.nyanide.com)'s status on Saturday, 03-May-2025 13:50:28 JST nyanide :nyancat_rainbow::nyancat_body::nyancat_face:
ALRIGHT THATS 83 LINES OF LINKED LIST CREATION CODE LETS SEE IF THIS WORKS FIRST TRY - soberano likes this.
-
Embed this notice
pwm (pwm@darkdork.dev)'s status on Saturday, 03-May-2025 13:51:27 JST pwm
@nyanide you_dereferenced_a_null_pointer.mpeg prettygood repeated this. -
Embed this notice
nyanide :nyancat_rainbow::nyancat_body::nyancat_face: (nyanide@lab.nyanide.com)'s status on Saturday, 03-May-2025 14:06:32 JST nyanide :nyancat_rainbow::nyancat_body::nyancat_face:
@pwm :kannadie: prettygood and pwm like this. -
Embed this notice
pwm (pwm@darkdork.dev)'s status on Saturday, 03-May-2025 14:07:13 JST pwm
@nyanide CALLED IT prettygood likes this. -
Embed this notice
nyanide :nyancat_rainbow::nyancat_body::nyancat_face: (nyanide@lab.nyanide.com)'s status on Saturday, 03-May-2025 14:12:33 JST nyanide :nyancat_rainbow::nyancat_body::nyancat_face:
@pwm omg even better, it segfaulted at a free lmfao pwm likes this. -
Embed this notice
pwm (pwm@darkdork.dev)'s status on Saturday, 03-May-2025 14:13:14 JST pwm
@nyanide YOU FREED AN INVALID POINTER -
Embed this notice
nyanide :nyancat_rainbow::nyancat_body::nyancat_face: (nyanide@lab.nyanide.com)'s status on Saturday, 03-May-2025 14:17:10 JST nyanide :nyancat_rainbow::nyancat_body::nyancat_face:
@pwm uh, it tried to free NULL which i thought free would just ignore pwm likes this.pwm repeated this. -
Embed this notice
nyanide :nyancat_rainbow::nyancat_body::nyancat_face: (nyanide@lab.nyanide.com)'s status on Saturday, 03-May-2025 14:17:46 JST nyanide :nyancat_rainbow::nyancat_body::nyancat_face:
@pwm idk maybe i dreamt this but i remember saying "omg free actually freed null!!!" and people were telling me "its in the spec buckaroo" and i was mystified pwm likes this. -
Embed this notice
pwm (pwm@darkdork.dev)'s status on Saturday, 03-May-2025 14:19:36 JST pwm
@nyanide You can't free NULL, why would you ever free null? Only thing I could come up with is some sort of way to signal an internal state in free() but there is no such state -
Embed this notice
:ihavenomouth: (inginsub@clubcyberia.co)'s status on Saturday, 03-May-2025 14:19:39 JST :ihavenomouth:
@nyanide @pwm it wasn’t null enough pwm likes this. -
Embed this notice
Hildegunst von Mythenmetz of programming (condret@shitposter.world)'s status on Saturday, 03-May-2025 14:19:55 JST Hildegunst von Mythenmetz of programming
@nyanide @pwm it should ignore that -
Embed this notice
nyanide :nyancat_rainbow::nyancat_body::nyancat_face: (nyanide@lab.nyanide.com)'s status on Saturday, 03-May-2025 14:20:11 JST nyanide :nyancat_rainbow::nyancat_body::nyancat_face:
@pwm i just wanted to be lazy and ignore null checking pwm likes this. -
Embed this notice
gentoobro (gentoobro@shitpost.cloud)'s status on Saturday, 03-May-2025 14:20:25 JST gentoobro
#define free(x) do { if(x) free(x); } while(0)
pwm likes this. -
Embed this notice
pwm (pwm@darkdork.dev)'s status on Saturday, 03-May-2025 14:20:49 JST pwm
@condret @nyanide My guess is that it's undefined behavior/implementation defined -
Embed this notice
gentoobro (gentoobro@shitpost.cloud)'s status on Saturday, 03-May-2025 14:20:55 JST gentoobro
Also, if you don't know about and use valgrind, you should.
pwm likes this. -
Embed this notice
pwm (pwm@darkdork.dev)'s status on Saturday, 03-May-2025 14:21:16 JST pwm
@gentoobro @nyanide It's CY10, everyone hardnosed enough to still use C knows about valgrind (I think) -
Embed this notice
:ihavenomouth: (inginsub@clubcyberia.co)'s status on Saturday, 03-May-2025 14:21:32 JST :ihavenomouth:
@nyanide @pwm free does that internally -
Embed this notice
pwm (pwm@darkdork.dev)'s status on Saturday, 03-May-2025 14:21:34 JST pwm
@gentoobro @nyanide Though he might still be a lazy bum -
Embed this notice
nyanide :nyancat_rainbow::nyancat_body::nyancat_face: (nyanide@lab.nyanide.com)'s status on Saturday, 03-May-2025 14:23:03 JST nyanide :nyancat_rainbow::nyancat_body::nyancat_face:
@gentoobro @pwm i use it all the time when i write code, i'm planning to use it to try to find any potential memory leaks in this questionable code later -
Embed this notice
gentoobro (gentoobro@shitpost.cloud)'s status on Saturday, 03-May-2025 14:24:18 JST gentoobro
You never know. It's not mentioned in a lot of tutorials, and if you're working on a linked list and getting basic errors, you might be new. I don't keep track of who's at what general level.
pwm likes this.nyanide :nyancat_rainbow::nyancat_body::nyancat_face: repeated this. -
Embed this notice
pwm (pwm@darkdork.dev)'s status on Saturday, 03-May-2025 14:24:35 JST pwm
@gentoobro @nyanide kirby is just drunk and high and can't remember up from down -
Embed this notice
nyanide :nyancat_rainbow::nyancat_body::nyancat_face: (nyanide@lab.nyanide.com)'s status on Saturday, 03-May-2025 14:26:10 JST nyanide :nyancat_rainbow::nyancat_body::nyancat_face:
@pwm @gentoobro i'll prove your point: i don't actually know what free free'd, i just saw these 2 lines and assumed it free'd NULL even though failure calls a helper function which destroys the linked list -
Embed this notice
nyanide :nyancat_rainbow::nyancat_body::nyancat_face: (nyanide@lab.nyanide.com)'s status on Saturday, 03-May-2025 14:26:46 JST nyanide :nyancat_rainbow::nyancat_body::nyancat_face:
@pwm @gentoobro i like, need to get myself checked out i swear -
Embed this notice
pwm (pwm@darkdork.dev)'s status on Saturday, 03-May-2025 14:27:24 JST pwm
@nyanide @gentoobro Well if your helper function frees the data pointed too by the field string then that's your problem, you are explicitly freeing null when it's null -
Embed this notice
pwm (pwm@darkdork.dev)'s status on Saturday, 03-May-2025 14:27:42 JST pwm
@nyanide @gentoobro and if that doesn't check before freeing then that's that -
Embed this notice
gentoobro (gentoobro@shitpost.cloud)'s status on Saturday, 03-May-2025 14:28:00 JST gentoobro
It didn't fall back into the debugger so you could inspect it?
You weren't testing code outside of a debugger were you? ... were you?
-
Embed this notice
pwm (pwm@darkdork.dev)'s status on Saturday, 03-May-2025 14:28:00 JST pwm
@gentoobro @nyanide debugger is bloat, god gave us printf -
Embed this notice
pwm (pwm@darkdork.dev)'s status on Saturday, 03-May-2025 14:30:36 JST pwm
@gentoobro @nyanide macros are bloat debuggers are bloat everything I don't like is bloat
I use clion btw -
Embed this notice
gentoobro (gentoobro@shitpost.cloud)'s status on Saturday, 03-May-2025 14:30:37 JST gentoobro
Debugger tells you where your shit crashed, and lets you see which variable is at fault.
Also, wrap your printf something like this:
#define dbg(fmt, ...) dprintf(STDERR_FILENO, "%s:%d " fmt "\n", strstr(__FILE__, "src/"), __LINE__ __VA_OPT__(,) __VA_ARGS__); -
Embed this notice
nyanide :nyancat_rainbow::nyancat_body::nyancat_face: (nyanide@lab.nyanide.com)'s status on Saturday, 03-May-2025 14:30:52 JST nyanide :nyancat_rainbow::nyancat_body::nyancat_face:
@gentoobro @pwm my mind is literally scrambled eggs dude
here's whats happening:
- failure state is triggered
- i go to mindlessly say that free somehow segfaulted at freeing null
- i then realize after like 5 posts that that was not the case and came to the correct conclusion that something in the helper function went wrong -
Embed this notice
gentoobro (gentoobro@shitpost.cloud)'s status on Saturday, 03-May-2025 14:31:37 JST gentoobro
Proper C should be 70% macros.
pwm likes this. -
Embed this notice
Hildegunst von Mythenmetz of programming (condret@shitposter.world)'s status on Saturday, 03-May-2025 14:31:42 JST Hildegunst von Mythenmetz of programming
@pwm @nyanide i'm very sure this is defined behaviour pwm likes this. -
Embed this notice
nyanide :nyancat_rainbow::nyancat_body::nyancat_face: (nyanide@lab.nyanide.com)'s status on Saturday, 03-May-2025 14:31:58 JST nyanide :nyancat_rainbow::nyancat_body::nyancat_face:
@condret @pwm no yeah it's working fine, free tries to free null a few more times in the code i just, mindlessly assumed it did after a failure state was triggered -
Embed this notice
pwm (pwm@darkdork.dev)'s status on Saturday, 03-May-2025 14:32:09 JST pwm
@condret @nyanide /shrug I can't say I've done it in recent history but I could see the argument for it being defined as a no-op -
Embed this notice
pwm (pwm@darkdork.dev)'s status on Saturday, 03-May-2025 14:32:36 JST pwm
@nyanide @condret you know what they say about assuming (and not using a debugger you freak) -
Embed this notice
nyanide :nyancat_rainbow::nyancat_body::nyancat_face: (nyanide@lab.nyanide.com)'s status on Saturday, 03-May-2025 14:33:06 JST nyanide :nyancat_rainbow::nyancat_body::nyancat_face:
@pwm @condret gdb has been open for like 15 minutes lmfao -
Embed this notice
nyanide :nyancat_rainbow::nyancat_body::nyancat_face: (nyanide@lab.nyanide.com)'s status on Saturday, 03-May-2025 14:33:38 JST nyanide :nyancat_rainbow::nyancat_body::nyancat_face:
@pwm @condret add an extra 10 min to that i have so much damn brainfog and i can hardly keep track of time rn -
Embed this notice
Hildegunst von Mythenmetz of programming (condret@shitposter.world)'s status on Saturday, 03-May-2025 14:34:59 JST Hildegunst von Mythenmetz of programming
@pwm @nyanide yes, it is
"The free() function frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc(), calloc() or realloc(). Otherwise, or if free(ptr) has already been called before, undefined behavior occurs. If ptr is NULL, no operation is performed."
https://linux.die.net/man/3/freepwm likes this. -
Embed this notice
Hildegunst von Mythenmetz of programming (condret@shitposter.world)'s status on Saturday, 03-May-2025 14:36:07 JST Hildegunst von Mythenmetz of programming
@nyanide @pwm use r2, the commands are much shorter than in gdb, also asm syntax of r2 is more readable than atnt pwm likes this. -
Embed this notice
pwm (pwm@darkdork.dev)'s status on Saturday, 03-May-2025 14:36:32 JST pwm
@condret @nyanide I for one HATE at&t
I learned on Intel and it is so much better. -
Embed this notice
gentoobro (gentoobro@shitpost.cloud)'s status on Saturday, 03-May-2025 14:36:42 JST gentoobro
You could override free with your own allocator that makes freeing null run the syscalls to wipe out the TLB cache. Because reasons.
pwm likes this. -
Embed this notice
Hildegunst von Mythenmetz of programming (condret@shitposter.world)'s status on Saturday, 03-May-2025 14:41:07 JST Hildegunst von Mythenmetz of programming
@pwm @nyanide intel syntax is objectivly better than atnt, however it is bloated. why write
mov eax, dwordptr [ebx]
if you could instead just write
mov eax, [ebx]
?pwm likes this. -
Embed this notice
pwm (pwm@darkdork.dev)'s status on Saturday, 03-May-2025 14:43:47 JST pwm
@condret @nyanide I've always been a nasm guy, which is smarter about that in its language. -
Embed this notice
pwm (pwm@darkdork.dev)'s status on Saturday, 03-May-2025 14:44:59 JST pwm
@condret @nyanide well, more terse. -
Embed this notice
pwm (pwm@darkdork.dev)'s status on Saturday, 03-May-2025 14:45:34 JST pwm
@pernia @nyanide @gentoobro > bro is scared by big letters
Zoomers are COOKED chat -
Embed this notice
þernia (pernia@cum.salon)'s status on Saturday, 03-May-2025 14:45:36 JST þernia
@gentoobro @pwm @nyanide 70% of ur ENTIRE WORLD is FAKE. I cant live with that.
Also the capital letters r unsettling -
Embed this notice
þernia (pernia@cum.salon)'s status on Saturday, 03-May-2025 14:45:37 JST þernia
@gentoobro @pwm @nyanide that sounds like hell -
Embed this notice
gentoobro (gentoobro@shitpost.cloud)'s status on Saturday, 03-May-2025 14:45:37 JST gentoobro
This is about 70% macros. Much more readable than the alternative.