+ 13
Do some challenge questions promote bad practice?
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? https://www.sololearn.com/post/179198/?ref=app
6 Respostas
+ 12
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++).
https://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Zero-Length.html
+ 9
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.
+ 7
Of course I would never write code such as the following other than to examine challenge question output but could it encourage anyone?
https://code.sololearn.com/cb8pkbJHVsoI/?ref=app
+ 6
Sonic you have asked these question in past too so why again new thread I guess that time it answered already
https://www.sololearn.com/Discuss/1741807/?ref=app
https://www.sololearn.com/Discuss/1214143/?ref=app
+ 2
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.
+ 2
Maybe not. Challenges are sudden and they do disrupt our studying discipline. It depends upon how you handle your challenges ( whether through betting or guess or by genuinely answering)