Skip to content

several #elseif expect as many #endif #31

Description

@elrandira

I don't know what people expect:
The following code is valid according to the current algorithm

#if A
print('A')
#elseif B
print('B')
#elseif C
print('C')
#else
print('D')
#endif
#endif
#endif

or this one:

#if A
print('A')
#elseif B
print('B')
#elseif C
print('C')
#else
print('D')
#endif3

but no this one (which is valid in C if I am not wrong):

#if A
print('A')
#elseif B
print('B')
#elseif C
print('C')
#else
print('D')
#endif

shouldn't it be the reverse?

https://docs.microsoft.com/en-us/cpp/preprocessor/hash-if-hash-elif-hash-else-and-hash-endif-directives-c-cpp?view=msvc-170

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions