+ 1
How are tested challenge's codes ?
Sololearn's environment strange behavior... poor learning :'( https://code.sololearn.com/cobbwa2wj4iC/?ref=app
6 Answers
+ 3
According to the C ( and C++ ) standard an undefined macro evaluates to 0 so "Try Again" is the correct output.
You can use the -Wundef and -Werror flags to make it an error though, but that would generate a different error than what gcc 10 generated. ( "SOLO" is not defined, evaluates to 0 )
It would be weird if undefined macros would be an error because then you wouldn't be able to conditionally compile certain parts of code.
It compiles correctly on https://godbolt.org/z/EW6v1E with gcc 10 compiler without error.
Just to prevent confusion, SOLO is assumed to be a macro here, NOT an identifier.
Sololearn uses gcc as the compiler too, btw.
+ 1
MY fault ! Too much warnings enabled in my IDE ? ;)
I dont push my research far enough on Stackoverflow...
+ 1
I only see, header file not included warning...
#if !SOLO means if not defined SOLO. (about macro).
It is different from if( ! SOLO), here it will error as "declare it before you use..."
(Correct me if am wrong..
@Dennis...)
+ 1
Thanks to all for your comments !
0
Jayakrishnađźđł
Yea, that's correct.
I ignored the header file warning because of the comment.
0
Dennis thanks sir, for the feedback..