Wireshark mailing list archives

Re: Use of variadic macros


From: Graham Bloice <graham.bloice () trihedral com>
Date: Thu, 1 Oct 2015 17:31:07 +0100

On 1 October 2015 at 17:25, Peter Wu <peter () lekensteyn nl> wrote:

#include <stdio.h>
    #define FOO(fmt, ...) printf(fmt, #__VA_ARGS__, __VA_ARGS__)
    int main() {
      return FOO("%s test %d\n", 1);
    }


VS2013 appears to be happy, compiling the file with a .c extension:

c:\temp>cl var.c
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

var.c
Microsoft (R) Incremental Linker Version 12.00.31101.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:var.exe
var.obj

c:\temp>.\var.exe
1 test 1


-- 
Graham Bloice
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: