Блог пользователя nor

Автор nor, 2 года назад, По-английски
  • Проголосовать: нравится
  • +136
  • Проголосовать: не нравится

»
2 года назад, # |
  Проголосовать: нравится -26 Проголосовать: не нравится

Bullshit.

»
2 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Great blog.

»
2 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

The moment I read the title of the blog, I was anticipating rainboy pun.

»
2 года назад, # |
  Проголосовать: нравится +32 Проголосовать: не нравится

While I really like C, and I have been using along with (or it instead of) C++, I think it must be said that C basically worse than C++ for competitive programming. People who use it instead of C++ are just doing it for the extra challenges.

That being said, wouldn't a worse version of C (C11) provide even more challenge, compared to a version without defects (C17)? There are solution for the defects in C11, so it's not like those are impossible to live with.

Personally I support the addition of C17 or newer C in the future, but I think C11 should not be lost for that to happen ("abandoned in favor of C17"). Once upon a time (pre 2017), C++98 and C++11 was available here, but they are now gone. From C++11 to C++14 there might not be much of a change, but from C++98 to C++11 is a massive different, some C++98 code wouldn't compile under C++11 for example. My reasons for preserving old versions of languages in general are:

  • It's better to have more options

  • Bureaucracy in onsite contests often means that newer versions of the language might not be available, personally, I have participated in onsite contests (in 2016-2017 or so) that only support C++98. Some contests also doesn't say anything about the version of the language (no feedback until the contest is over), so the best option is to write code that will compile and work in all the standards. Tldr: Some time people are forced to use old version of the languages, and it's good to have those version available for practicing.

  • »
    »
    2 года назад, # ^ |
    Rev. 3   Проголосовать: нравится +26 Проголосовать: не нравится

    Thanks for the detailed comment.

    Regarding your first point, the main reason why I say that C is relevant is basically getting some sort of a handicap while coding, in the hope that it will force you to think more towards the solution rather than starting implementing it right away -- I find it very easy to do in C++ but not in C. Of course, in actual competitions (and training to make implementation faster), it is strictly better to use C++.

    The C11 defect reports I mentioned are mostly concerned with some rare weird behavior (and weird edge/ambiguous cases that needed to be ironed out), and are almost irrelevant for competitive programming, so it should be fine to have C11 (64 bit) in most cases. The reason I suggested using C17 for the new option on CF was that C17 has a more sane set of defaults in those edge cases (and fixing defect reports is in fact the only change that happens; no new features whatsoever). C is a much more stable language than C++, and the changes from C11 to C17 are nowhere near as significant as those from any revision of C++ to another.

    I agree with you on not removing C11 (but only adding C17 (64 bit) as a new option) -- I should have phrased that in a better manner.

»
2 года назад, # |
  Проголосовать: нравится +25 Проголосовать: не нравится

Joke on you I'll just compete in Pascal.

»
2 года назад, # |
  Проголосовать: нравится +45 Проголосовать: не нравится

Reading your "Why you would want to code in C" completely convinced me. That is, convinced me that I made the correct choice going for C++