On 01/23/2014 11:13 AM, Krzysztof Opasiak wrote: >> -----Original Message----- >> From: David Laight [mailto:David.Laight@xxxxxxxxxx]> >> From: Of Stanislaw Wadas >>> Add inline to gadget_write_string(). >> ... >>> -static void usbg_write_string(char *path, char *name, char >> *file, char *buf) >>> +static inline void usbg_write_string(char *path, char *name, >> char *file, char *buf) >>> { >>> usbg_write_buf(path, name, file, buf); >>> } >> >> Why? >> The compiler is very unlikely not to inline it anyway. >> >> If it doesn't inline it, then specifying 'inline' probably >> won't make any difference either. >> > > I agree that new version of gcc can do this without explicit inline, but > please think about some legacy systems and compilers. Older versions of > gcc or other compilers may not inline this function if there is no > keyword. We should write portable code and don't depend on any version > of compiler. So to do it good we should pass as much information to > compiler as possible. Given different optimization flags (-Os vs -O3) compiler can generate completely different code. Both will be "optimal" but by completely different criteria. We should not try to outsmart compiler, it's usually way smarter than us. Cheers, Karol -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html