Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1348071

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

From Borislav Petkov <bp@alien8.de>
Newsgroups linux.kernel
Subject Re: [PATCH 01/10] selftests/x86: In syscall_nt, test NT|TF as well
Date 2016-03-02 15:30 +0100
Message-ID <r8fWN-pB-7@gated-at.bofh.it> (permalink)
References <r7oz8-6aX-5@gated-at.bofh.it> <r7oz8-6aX-7@gated-at.bofh.it> <r8eHo-80v-3@gated-at.bofh.it> <r8fDs-gr-33@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 01/10] selftests/x86: In syscall_nt, test NT|TF as well Andy Lutomirski <luto@kernel.org> - 2016-02-29 06:30 +0100
  Re: [PATCH 01/10] selftests/x86: In syscall_nt, test NT|TF as well Borislav Petkov <bp@alien8.de> - 2016-03-02 14:10 +0100
    Re: [PATCH 01/10] selftests/x86: In syscall_nt, test NT|TF as well One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-03-02 15:10 +0100
      Re: [PATCH 01/10] selftests/x86: In syscall_nt, test NT|TF as well Borislav Petkov <bp@alien8.de> - 2016-03-02 15:30 +0100
        Re: [PATCH 01/10] selftests/x86: In syscall_nt, test NT|TF as well Andy Lutomirski <luto@amacapital.net> - 2016-03-02 20:10 +0100
          Re: [PATCH 01/10] selftests/x86: In syscall_nt, test NT|TF as well Borislav Petkov <bp@alien8.de> - 2016-03-02 20:40 +0100

csiph-web