-
Notifications
You must be signed in to change notification settings - Fork 439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Made arguments struct within SDL2application take in (and store) argc by value instead of reference #638
base: master
Are you sure you want to change the base?
Conversation
Hi, the reason for this was to give the library / engine code a chance to filter the arguments. So for example it'd consume arguments it recognizes, removes them from the Qt, for example, does the same. At the moment however, nothing from the library actually modifies the argument list, because Utility::Arguments is made in a way that allows several argument parsers to coexist, and so it wasn't deemed neccessary. That can eventually change tho. Is this causing some problems on your end? If so, what's your use case? Or were you just curious why it was done this way? |
I'm working on a project where argc and argv are passed into a few functions before they are passed to magnum within a lambda meaning that every function that passed argc and v to the next one needs to take them in by reference instead of copying which would be simpler. Its not that big of a deal, I honestly just thought that argc being a reference was a mistake as opposed to inentional. |
Interesting. The assumption I made on my end was that the application class would be always the most top-level thing in But if you have a bunch of functions wrapping that, I can see how that can get annoying, yeah. The arguments are not critically important, so if the application code itself doesn't need to parse anything from the command line, there's just the I could also add a constructor overload that doesn't take the |
I suppose this raises the question of what negative harm there would be if the arguments weren't mutated by the application class. Having a few extra entries that are namespaces shouldn't hurt code that understands it may have to discard unknown arcs. |
Good point. If I would be designing the But back when I designed this in 2010, I thought |
I guess if you don't think the backwards compat can be addressed. There's always SDL3, which is now available. So instead of fixing it in the sdl2application class, you apply the fix to the sdl3application class. I'd really like to use sdl3 over 2, because they fixed an issue with being able to compile with mingw and I've been wanting to add mingw to my CI for ages. |
Yes, but I want to have the behavior consistent between Switching between SDL and GLFW isn't all that common, but (Sorry if it sounds like I'm just piling up reasons why I can't change anything, that's not the intent. Just explaining the background.) |
I think this must be left over from a previous version of the software or something, it seems really weird that this struct needs to hold onto argc as a reference, and why it cant just copy it in, its one int, and I have no idea why it would change.