Re: [dev] key-value config reader

2019-05-12 Thread Piotr Oleskiewicz
Hi Michael, > What about _Generic in C11? This allows you to choose an expression > based on the type of another expression. Looks like a much better version of something I tried implementing on my first try, thanks a lot! Best, Piotr

Re: [dev] key-value config reader

2019-05-12 Thread Hiltjo Posthuma
On Sun, May 12, 2019 at 12:45:42PM +0200, Markus Wichmann wrote: > On Sun, May 12, 2019 at 01:30:10AM -0700, Michael Forney wrote: > > What about _Generic in C11? This allows you to choose an expression > > based on the type of another expression. > > God dammit, looks like I need to get some C11

Re: [dev] key-value config reader

2019-05-12 Thread Markus Wichmann
On Sun, May 12, 2019 at 01:30:10AM -0700, Michael Forney wrote: > What about _Generic in C11? This allows you to choose an expression > based on the type of another expression. God dammit, looks like I need to get some C11 training under my belt. Completely forgot _Generic was a thing. Ciao, Mark

Re: [dev] key-value config reader

2019-05-12 Thread Michael Forney
On 2019-05-12, Markus Wichmann wrote: > On Sat, May 11, 2019 at 08:52:32PM +0100, Piotr Oleskiewicz wrote: >> I would prefer to >> write >> >> X(int, i, 1) >> >> rather than >> >> X(int, i, atoi, "%d", 1) >> >> Many thanks, >> Piotr >> > > That is going to be tough, as in C in a macro, t

Re: [dev] key-value config reader

2019-05-12 Thread Markus Wichmann
On Sat, May 11, 2019 at 08:52:32PM +0100, Piotr Oleskiewicz wrote: > I would prefer to > write > > X(int, i, 1) > > rather than > > X(int, i, atoi, "%d", 1) > > Many thanks, > Piotr > That is going to be tough, as in C in a macro, there is no way to really determine what type name you

[dev] key-value config reader

2019-05-11 Thread Piotr Oleskiewicz
Hi, I wrote a very simple config reader for C programs that require frequent re-configuration. It is ~60 lines, header only (X Macros), and accepts key-value pairs. Here it is: https://src.oleskiewi.cz/kv/ Could I ask for some feedback & comments? Two things I wanted to focus on next are (1) a