Would a question such as the following promote users to write bad code such as the use of negative indexes in C++ arrays which are not protected by default by compilers such as gcc?
Sonic yes this is question can be said as outdated and only run on gnu extension compilers like sololearn have.
In Standard C and C++, zero-size array is not allowed..
If you're using GCC, compile it with -pedantic option. It will give warning,
The code is only executable on compiler gcc and gnu version like C99 and it is treated as an error in others (e.g., Visual C++).
GAWEN STEASY thanks. OMG I had forgotten that I asked it before!! Obviously my memory is not very good or the use of C++ in my brain caused some new information to overwrite the old memory, probably using a negative array index and causing me to forget by corrupting the old memory!
However, this was more of a general question for which the referenced code was an example.
Sonic you have asked these question in past too so why again new thread I guess that time it answered already
Guys remember that if you suspect that a question is wrong, or in this case, promotes bad practices, report it so that Sololearn can evaluate it. That's the only way to get these outdated concepts out of the quizzes
most of the general questions that trip me up are bad programmming pracrices that are also valid. It can be helpful for certification prep to distinguish between validity and proper programming convention in industry.