Re: [PATCH v4 3/9] checkout.[ch]: move struct declaration into *.h
From: Junio C Hamano <hidden>
Date: 2018-06-01 02:14:55
2 messages, 2 authors, 2018-06-01 · open the first message on its own page
From: Junio C Hamano <hidden>
Date: 2018-06-01 02:14:55
Thomas Gummerer [off-list ref] writes:
We seem to have plenty of structs defined in '.c' files, if they are only needed there. Its use also seems to be single purpose for the callback data, so I'm a bit puzzled how having this in a header file instead of the .c file would be helpful? I feel like having only the "public" part in the header file also helps developers that are just looking for documentation of the functions they are looking at, by having less things to go through, that they wouldn't necessarily care about.
Yup, sounds like a sensible criterion to choose between <*.h> and <*.c>.
From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2018-06-01 09:57:07
On Fri, Jun 01 2018, Junio C Hamano wrote:
Thomas Gummerer [off-list ref] writes:quoted
We seem to have plenty of structs defined in '.c' files, if they are only needed there. Its use also seems to be single purpose for the callback data, so I'm a bit puzzled how having this in a header file instead of the .c file would be helpful? I feel like having only the "public" part in the header file also helps developers that are just looking for documentation of the functions they are looking at, by having less things to go through, that they wouldn't necessarily care about.Yup, sounds like a sensible criterion to choose between <*.h> and <*.c>.
Yes this makes sense. Thanks both. I misunderstood the idiom. Makes sense in hindsight (& with both of your advices) only to put structs in the *.h if it's actually used outside of that API. Will move this around in v5.