How are tested challenge's codes ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How are tested challenge's codes ?

Sololearn's environment strange behavior... poor learning :'( https://code.sololearn.com/cobbwa2wj4iC/?ref=app

31st Jul 2020, 1:28 PM
Bernard Bordja
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.
31st Jul 2020, 2:11 PM
Dennis
Dennis - avatar
+ 1
MY fault ! Too much warnings enabled in my IDE ? ;) I dont push my research far enough on Stackoverflow...
31st Jul 2020, 3:03 PM
Bernard Bordja
+ 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...)
31st Jul 2020, 3:07 PM
Jayakrishna 🇮🇳
+ 1
Thanks to all for your comments !
31st Jul 2020, 3:34 PM
Bernard Bordja
0
Jayakrishna🇮🇳 Yea, that's correct. I ignored the header file warning because of the comment.
31st Jul 2020, 3:09 PM
Dennis
Dennis - avatar
0
Dennis thanks sir, for the feedback..
31st Jul 2020, 3:11 PM
Jayakrishna 🇮🇳