zx-project / zx

A collection of experimental ZZ modules
MIT License
7 stars 0 forks source link

'zargv' review #4

Open jwerle opened 4 years ago

jwerle commented 4 years ago

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

cc @aep

aep commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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