Skip to content
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

'zargv' review #4

Open
jwerle opened this issue Apr 8, 2020 · 3 comments
Open

'zargv' review #4

jwerle opened this issue Apr 8, 2020 · 3 comments

Comments

@jwerle
Copy link
Member

jwerle commented Apr 8, 2020

https://github.com/zx-project/zx/tree/master/modules/zargv

cc @aep

@aep
Copy link

aep commented Apr 8, 2020

I'm excited about this one. Hopefully can test later.

One thing that I immediately noticed is that you hardcore the pool size. You can pass a tail argument to the outer strucure instead like:

struct Anything+ {
Pool+ p;
}

Now you can construct Anything+poolsize

@jwerle
Copy link
Member Author

jwerle commented Apr 8, 2020

I thought about allowing that at first, but I found it awkward to come up with all the bytes you might need in order to parse command line arguments. Allocations are used for Argument * pointers and nullterm string copies of unknown arguments which might be hard for the caller to plan for. I chose 4096 arbitrarily. Would it make sense to allow callers to provide a pointer to a pool they allocated?

@jwerle
Copy link
Member Author

jwerle commented Apr 8, 2020

Still getting used to the heapless world so I may be completely off base here

@jwerle jwerle changed the title Initial argument parser implementation 'zargv' review Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants