Thread (3 messages) 3 messages, 3 authors, 2020-08-07

Re: "#define precompose_argv(c,v) /* empty */" is evil

From: brian m. carlson <hidden>
Date: 2020-08-07 00:01:38

On 2020-08-06 at 23:47:34, Junio C Hamano wrote:
I am wondering if it is a good idea to use something like

    static inline void precompose_argv(int argc, const char **argv)
    {
	; /* nothing */
    }

instead.  As long as the compiler is reasonable enough, this should
not result in any code change in the result, except that it would
still catch wrong arguments, even if these two parameters are unused
and optimized out.
Yes, this seems like a prudent approach.  I believe it's widely used by
the Linux kernel, so presumably compilers are capable enough to optimize
it out.  As you noted, it provides type checking for all platforms,
which is nice.
-- 
brian m. carlson: Houston, Texas, US

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help