pypreprocessor icon indicating copy to clipboard operation
pypreprocessor copied to clipboard

several #elseif expect as many #endif

Open elrandira opened this issue 3 years ago • 0 comments

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

elrandira avatar Dec 20 '21 17:12 elrandira