Re: [PATCH 01/10] selftests/x86: In syscall_nt, test NT|TF as well

From: Borislav Petkov
Date: Wed Mar 02 2016 - 09:29:11 EST


On Wed, Mar 02, 2016 at 02:01:15PM +0000, One Thousand Gnomes wrote:
> int main(void) is wrong as there are passed arguments

Not in this particular case - test doesn't take args.

> int main() is ok (in C89 at least) because it means "there are unknown
> arguments"
>
> int main(int argc, char *argv[]) is allowed
>
> int main(void) is not safe on all platforms because some compilers
> choose to do the argument cleanup in the return path of the called
> function. Having the wrong number of arguments doesn't end well in such
> cases. I doubt any Linux platforms do this but we shouldn't be
> encouraging bad programming techniques 8)

There's also the variadic thing. Here's hpa's sermon from a couple of
years ago:

http://thread.gmane.org/gmane.linux.kernel/1268751/focus=1268792

:-))))

--
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.