Hi, On 2019-01-15 14:37:36 +0530, Amit Khandekar wrote: > Then for each of the calls, we would need to declare that structure > variable (with = {0}) and assign required fields in that structure > before passing it to ArchiveEntry(). But a major reason of > ArchiveEntry() is to avoid doing this and instead conveniently pass > those fields as parameters. This will cause unnecessary more lines of > code. I think better way is to have an ArchiveEntry() function with > limited number of parameters, and have an ArchiveEntryEx() with those > extra parameters which are not needed in usual cases.
I don't think that'll really solve the problem. I think it might be more reasonable to rely on structs. Now that we can rely on designated initializers for structs we can do something like ArchiveEntry((ArchiveArgs){.tablespace = 3, .dumpFn = somefunc, ...}); and unused arguments will automatically initialized to zero. Or we could pass the struct as a pointer, might be more efficient (although I doubt it matters here): ArchiveEntry(&(ArchiveArgs){.tablespace = 3, .dumpFn = somefunc, ...}); What do others think? It'd probably be a good idea to start a new thread about this. Greetings, Andres Freund