The difference between G++ and C++ in OJ

  • 2020-06-12 10:05:03
  • OfStack

First of all, C++ is a computer programming language, G++ is not a language, is a compiler to compile C++ program command.

So what's the difference between them?

In the language options in the submission question, G++ and C++ both represent how it will be compiled. To be precise, choosing C++ means that you will be compiling with the most standard method, ANSI C++. If you are using G++, this means that you will be compiling with the most common compiler available in GNU (the familiar compiler for Code::Blocks, gcc for Windows 1, gcc for Linux and GNU 1). Similarly, select C, which is compiled with the standard C compiler, and GCC, which is also compiled with gcc.

G++ and C++ differ in oj

1. When exporting double type, if G++ is used for submission, scanf %lf and prinf %f, an error will be reported

2. Reminder of using GCC/G++ :
With each 64-bit integer, long long and ___, int64 are supported and equivalent, but only scanf("%I64d",...) And printf (" % I64d ",...). "%lld" is not supported because msvcrt. dll dynamic link library under MinGW and G++ does not support C99 standard.
According to the ISO C++ standard, under G++, the return value of the main function must be int, otherwise it will result in a verdict of Compile Error(compile error)

3. G++/GCC Use scanf and printf < stdio.h > And reference only < iostream > Do not recognize (Hang power OJ G++ not required < stdio.h > )

Supplement:

Each ___ 96EN64 and long long are the data types of 64-bit integers to be used at the start of the 32-bit platform, with no difference in how they are stored and used.
The difference is that they are named by different sponsors and support different platforms. The data type of long long, sponsored and supported by the UNIX platform, and supported by Microsoft starting with win95 (VC6), with the old windows development platform (such as VC6), long long and _int64 with the old UNIX. Of course, now that the platform is relatively new, both data formats and related definitions and functions are compatible.

Similarly, the printf output format definition as a 64-bit integer is the same, with Microsoft using %i64d and UNIX using %lld and %llu (unsigned 64-bit).

In fact, no matter which one is used, there is no difference in practical effect, just because of the supported or unsupported issues caused by the definer and the usage environment.
With ACM, the compiler identification system is more compliant with the Definition of the Microsoft system, so use each ___ 124EN64 and %i64d

conclusion


Related articles: