actualtsg's blog

By actualtsg, history, 3 weeks ago, In English

GCC 5.1 is too old and slow for today standard! I have encountered so many problem because of it

"qsort" implementation is slow:

"%lf" on printf is not working (scanf is worked), should be "%f" but that for float not double:

    • code 500D: (364906153 WA) (364906215 AC after 10 retries figuring out that the problem was %lf!)
    • comment: you can see on my WA submission that I just printing 2.0 but output always 0.0 for unknown reason :(

sscanf / sprintf is slow:

"%hhu" is not working (can't scan / print unsigned char number from stdin / to stdout directly):

    • comment: compiler is too old for the %hhu feature :(

Calling printf frequently is slow in C but fast on C++:


Conclusion: The old compiler has a lot of problem! Imagine using unoptimized gcc 5 on 2026 >,< Now there is gcc 15 which is 10 versions above. Why not upgrade the compiler? @MikeMirzayanov

  • Vote: I like it
  • +76
  • Vote: I do not like it

»
3 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

What stops you from writing C code in C++?

  • »
    »
    3 weeks ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it
    1. we want to submit in the best language to us

    2. C would run faster then C++ on it's compiler, but if we submit in C++ compiler, then they are of same speed(as I know)

  • »
    »
    3 weeks ago, hide # ^ |
     
    Vote: I like it +1 Vote: I do not like it

    g++ is optimized for c++ not c

  • »
    »
    3 weeks ago, hide # ^ |
     
    Vote: I like it +1 Vote: I do not like it

    First of all my background is not computer science, I'm from electronic and robotic student, so my primary language is pure C (without plus-plus), I never touches c++ because is was not necessary. I'm here because of my computer science friend and because of just curiosity (also want some brain work out) ;)

    Second, C++ is not strict super-set of C, there are a lot of differences between it, see this Wiki for details: https://en.wikipedia.org/wiki/Compatibility_of_C_and_C++

»
3 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Man, using C is kind of Flex at this stage I'd say!

You have my respect.

  • »
    »
    3 weeks ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Thank you <3 but I'm not flexing, I'm using C because it is the only programming language I know (for now).