ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Use of variadic macros

From: Graham Bloice <graham.bloice@xxxxxxxxxxxxx>
Date: Thu, 1 Oct 2015 17:31:07 +0100

On 1 October 2015 at 17:25, Peter Wu <peter@xxxxxxxxxxxxx> 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