hrszpuk / odin-flag

Command-line flags package for odin
MIT License
0 stars 0 forks source link

Flag parsing #2

Closed hrszpuk closed 10 months ago

hrszpuk commented 1 year ago

Note to self...

Had issues with CommandLineFlagData.value resetting to 0 after the parse function has ended. I expected the value to remain 100 but alas, after many hours of debugging, I give up.

Work around: Instead of storing .value as any I used a rawptr and did some pointer magic to get integers working. The same work around should work for other data types too.

Work around ##2: If that doesn't work out then I also found storing the value as it's basic type with some kind of composition and multiple CommandLineFlagData structs to be undesirable but functional.

hrszpuk commented 1 year ago

Jesus christ what have I woken up to

hrszpuk commented 1 year ago

Okay so the rawptr implementation worked but now any kind of manual memory management causes a segfault...

hrszpuk commented 1 year ago

I've done goofed scoob

hrszpuk commented 1 year ago

(refactoring the messy code, fixed the segfaults 😌)