noogler's blog

By noogler, 10 years ago, translation, In English

Is this code below works on all platform with C++11 compiler?

I know that earlier we had to to use "%I64d" for Windows platform and "%lld" for linux like platforms.

long long = (long long)1e18;
printf("%lld\n", a);
  • Vote: I like it
  • +5
  • Vote: I do not like it

»
10 years ago, # |
Rev. 4   Vote: I like it 0 Vote: I do not like it

No it doesn't.
UPD: I suddenly realised I might've been wrong. I do have problems with --std=gnu++11 but, apparently, there's no such problem with --std=c++11.

  • »
    »
    10 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    CODE from last round got Accepted. And Codeforces is on windows platform.

»
10 years ago, # |
  Vote: I like it +5 Vote: I do not like it

you may check it in the Standard but as far as I remember it's now in standard so it should work in every compliant compiler.

  • »
    »
    10 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Not that this means much when mingw is notoriously non-compliant. Ever tried printing long doubles? (Also, for some reason, you have to read doubles with %lf and print with %f, even though they should be equivalent).

»
10 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Strangely, it works on every compiler on Codeforces

P.S. WIN32 is defined, as I see

»
10 years ago, # |
  Vote: I like it +21 Vote: I do not like it

It works. Even -std=c++11 -Wpedantic gives no warnings. It seems that the code is correct in ISO C++ 2011 Standard.