On Mon, Jul 23, 2018 at 5:37 PM Dan Kennedy <danielk1...@gmail.com> wrote:

> On 07/23/2018 06:36 PM, Dominique Devienne wrote:
> > On Mon, Jul 23, 2018 at 12:57 PM Dan Kennedy <danielk1...@gmail.com>
> wrote:
> > The diff adds:
> >
> > #define CTIMEOPT_VAL2_(opt1,opt2) #opt1 "," #opt2
> > #define CTIMEOPT_VAL2(opt) CTIMEOPT_VAL2_(opt)
> >
> > But don't you mean the below instead?
> >
> > #define CTIMEOPT_VAL2_(opt1,opt2) #opt1 "," #opt2
> > #define CTIMEOPT_VAL2(opt) CTIMEOPT_VAL2_(opt, opt)
>
>
> Thanks for reviewing. I acknowledge it is a bit iffy.
>
> SQLITE_DEFAULT_LOOKASIDE should be defined as two comma-separated
> integers. e.g.
>
>    -DSQLITE_DEFAULT_LOOKASIDE="100,100"
>
> So CTIMEOPT_VAL2(SQLITE_DEFAULT_LOOKASIDE) expands to:
>
>    CTIMEOPT_VAL2_(100, 100)
>
> and so it works. If anybody knows a better way to do this (I'm no
> preprocessor expert!) that is ANSI-C compatible, I think we'd be happy
> to change the code.
>

I'm not either. And I knew I was missing something indeed. Thanks for
making it clear.
So whether the code builds fine depends on the define's value having the
correct format then.

That GNU cpp doc clearly states
"All arguments to a macro are completely macro-expanded before they are
substituted into the macro body"

And you correctly documented the format needed, I just didn't get it the
first time, that the define's value is "reparsed".
So all is fine, sorry for the noise. Your code doesn't need any changes.
--DD
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to