fork(6) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. define __STDC_FORMAT_MACROS 1
  5.  
  6. #include <inttypes.h>
  7.  
  8. inline std::string i64tostr(int64_t n)
  9. {
  10. char buf[ 1024 ];
  11. sprintf( buf, "%" PRId64, n );
  12. return buf;
  13. }
  14.  
  15. int main() {
  16. string s = i64tostr( 0LL );
  17. return 0;
  18. }
Compilation error #stdin compilation error #stdout 0s 3468KB
stdin
Standard input is empty
compilation info
prog.cpp:4:1: error: ‘define’ does not name a type
 define __STDC_FORMAT_MACROS 1
 ^
prog.cpp: In function ‘std::string i64tostr(int64_t)’:
prog.cpp:11:20: error: expected ‘)’ before ‘PRId64’
  sprintf( buf, "%" PRId64, n );
                    ^
prog.cpp:11:30: warning: spurious trailing ‘%’ in format [-Wformat=]
  sprintf( buf, "%" PRId64, n );
                              ^
prog.cpp:11:30: warning: too many arguments for format [-Wformat-extra-args]
stdout
Standard output is empty