Skip to content

variadic macros - no argument for ellipsis creates preprocessor parser error #605

@Bertk

Description

@Bertk

The sample on MSDN for variadic macros will create a parser error.
https://msdn.microsoft.com/en-us/library/ms177415.aspx

excerpt from sample to reproduce the Parser error:

#include <stdio.h>
#define EMPTY
#define MACRO(s, ...) printf(s, __VA_ARGS__)

int main() {
    MACRO("hello, world\n");

    MACRO("error\n", EMPTY); // would cause error C2059, except VC++ 
                             // suppresses the trailing comma

}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions