1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

AUTOSAR CountdownAdvent Calendar 2022

Day 4

C++N4606 (226)17.7 Header <cstdlib> synopsis [cstdlib.syn]p483

Last updated at Posted at 2018-04-22

はじめに

N4606 Working Draft, Standard for Programming Language C++
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/#mailing2016-11
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4606.pdf

n4606は、ISO/IEC JTC1 SC22 WG21の作業原案(Working Draft)です。
公式のISO/IEC 14882原本ではありません。
ISO/IEC JTC1 SC22 WG21では、可能な限り作業文書を公開し、幅広い意見を求めています。
一連の記事はコード断片をコンパイルできる形にする方法を検討してコンパイル、リンク、実行して、規格案の原文と処理系(g++, Clang++)との違いを確認し、技術内容を検討し、ISO/IEC JTC1 SC22 WG21にフィードバックするために用います。
また、CERT C++, MISRA C++等のコーディング標準のコード断片をコンパイルする際の参考にさせていただこうと考えています。CERT C++, MISRA C++が標準化の動きとの時間的なずれがあれば確認できれば幸いです。また、boostライブラリとの関連、Linux OS, TOPPERSカーネル、g++(GCC), clang++(LLVM)との関係も調査中です。
何か、抜け漏れ、耳より情報がありましたらおしらせくださると幸いです。

作業方針

1)コンパイルエラーを収集する。
2)コンパイルエラーをなくす方法を検討する。
コンパイルエラーになる例を示すだけが目的のコードは、コンパイルエラーをなくすのではなく、コンパイルエラーの種類を収集するだけにする。
文法を示すのが目的のコード場合に、コンパイルエラーをなくすのに手間がかかる場合は、順次作業します。
3)リンクエラーをなくす方法を検討する。
文法を示すのが目的のコード場合に、リンクエラーをなくすのに手間がかかる場合は、順次作業します。
4)意味のある出力を作る。
コンパイル、リンクが通っても、意味のある出力を示そうとすると、コンパイル・リンクエラーが出て収拾できそうにない場合がある。順次作業します。

1)だけのものから4)まで進んだものと色々ある状態です。一歩でも前に進むご助言をお待ちしています。「検討事項」の欄に現状を記録するようにしています。

list

N4606 Working Draft 2016, ISO/IEC 14882, C++ standard(1) coding list
https://qiita.com/kaizen_nagoya/items/df5d62c35bd6ed1c3d43/

Compiler

clang++ --version

clang version 6.0.0 (tags/RELEASE_600/final)
Target: x86_64-apple-darwin17.4.0

g++-7 --version

g++-7 (Homebrew GCC 7.3.0_1) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.

#(226)17.7 Header synopsis [cstdlib.syn]p483

p483.cpp
// N4606 Committee Draft, Standard for Programming Language C++
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4606.pdf
#define msg "(226)17.7 Header <cstdlib> synopsis [cstdlib.syn]p483.cpp"
// Edited by Dr. Ogawa Kiyoshi. Compile procedure and results record.

#include <iostream>
#include <cstdlib>

namespace std {
using std::size_t;// = see 18.2.3;
using std::div_t ;//= see below ;
using std::ldiv_t;// = see below ;
using std::lldiv_t;// = see below ;
}
//#define NULL //see 18.2.2
//#define EXIT_FAILURE //see below
//#define EXIT_SUCCESS //see below
//#define RAND_MAX //see below
//#define MB_CUR_MAX //see below
namespace std {
// 18.5, start and termination
[[noreturn]] void abort();
int atexit(void (*func)());
int at_quick_exit(void (*func)());
[[noreturn]] void exit(int status);
[[noreturn]] void _Exit(int status);
[[noreturn]] void quick_exit(int status);
char* getenv(const char* name);
int system(const char* string);
// 20.10.11, C library memory allocation
void* aligned_alloc(size_t alignment, size_t size);
void* calloc(size_t nmemb, size_t size);
void free(void* ptr);
void* malloc(size_t size);
void* realloc(void* ptr, size_t size);
double atof(const char* nptr);
int atoi(const char* nptr);
long int atol(const char* nptr);
long long int atoll(const char* nptr);
double strtod(const char* nptr, char** endptr);
float strtof(const char* nptr, char** endptr);
long double strtold(const char* nptr, char** endptr);
long int strtol(const char* nptr, char** endptr, int base);
long long int strtoll(const char* nptr, char** endptr, int base);
unsigned long int strtoul(const char* nptr, char** endptr, int base);
unsigned long long int strtoull(const char* nptr, char** endptr, int base);
// 21.5.6, multibyte / wide string and character conversion functions
int mblen(const char* s, size_t n);
int mbtowc(wchar_t* pwc, const char* s, size_t n);
int wctomb(char* s, wchar_t wchar);
size_t mbstowcs(wchar_t* pwcs, const char* s, size_t n);
size_t wcstombs(char* s, const wchar_t* pwcs, size_t n);
// 25.6, C standard library algorithms
extern "C" void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
                         int (*compar)(const void*, const void*));
extern "C++" void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
                           int (*compar)(const void*, const void*));
extern "C" void qsort(void* base, size_t nmemb, size_t size,
                      int (*compar)(const void*, const void*));
extern "C++" void qsort(void* base, size_t nmemb, size_t size,
                        int (*compar)(const void*, const void*));
// 26.6.9, low-quality random number generation
int rand();
void srand(unsigned int seed);
// 26.9.2, absolute values
int abs(int j);
long int abs(long int j);
long long int abs(long long int j);
float abs(float j);
double abs(double j);
long double abs(long double j);
long int labs(long int j);
long long int llabs(long long int j);
div_t div(int numer, int denom);
ldiv_t div(long int numer, long int denom); // see 17.2
lldiv_t div(long long int numer, long long int denom); // see 17.2
ldiv_t ldiv(long int numer, long int denom);
lldiv_t lldiv(long long int numer, long long int denom);
}

int main() {
  std::cout<< msg << std::endl;
  return EXIT_SUCCESS;
}
cppgl17.sh
$ ./cppgl17.sh p483
$ clang++ p483.cpp -std=c++17 
p483.cpp:56:20: error: declaration of 'bsearch' has a different language linkage
extern "C++" void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
                   ^
p483.cpp:54:18: note: previous declaration is here
extern "C" void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
                 ^
p483.cpp:60:19: error: declaration of 'qsort' has a different language linkage
extern "C++" void qsort(void* base, size_t nmemb, size_t size,
                  ^
p483.cpp:58:17: note: previous declaration is here
extern "C" void qsort(void* base, size_t nmemb, size_t size,
                ^
2 errors generated.

$ g++-7 p483.cpp -std=c++17 
p483.cpp:22:25: error: 'void std::abort()' conflicts with a previous declaration
 [[noreturn]] void abort();
                         ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:136:7: note: previous declaration 'void abort()'
 void  abort(void) __dead2;
       ^~~~~
p483.cpp:23:26: error: 'int std::atexit(void (*)())' conflicts with a previous declaration
 int atexit(void (*func)());
                          ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:138:6: note: previous declaration 'int atexit(void (*)())'
 int  atexit(void (* _Nonnull)(void));
      ^~~~~~
p483.cpp:25:34: error: 'void std::exit(int)' conflicts with a previous declaration
 [[noreturn]] void exit(int status);
                                  ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:150:7: note: previous declaration 'void exit(int)'
 void  exit(int) __dead2;
       ^~~~
p483.cpp:26:35: error: 'void std::_Exit(int)' conflicts with a previous declaration
 [[noreturn]] void _Exit(int status);
                                   ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:203:6: note: previous declaration 'void _Exit(int)'
 void _Exit(int) __dead2;
      ^~~~~
p483.cpp:28:30: error: 'char* std::getenv(const char*)' conflicts with a previous declaration
 char* getenv(const char* name);
                              ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:152:7: note: previous declaration 'char* getenv(const char*)'
 char *getenv(const char *);
       ^~~~~~
p483.cpp:29:30: error: 'int std::system(const char*)' conflicts with a previous declaration
 int system(const char* string);
                              ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:195:6: note: previous declaration 'int system(const char*)'
 int  system(const char *) __DARWIN_ALIAS_C(system);
      ^~~~~~
p483.cpp:32:39: error: 'void* std::calloc(std::size_t, std::size_t)' conflicts with a previous declaration
 void* calloc(size_t nmemb, size_t size);
                                       ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:148:7: note: previous declaration 'void* calloc(size_t, size_t)'
 void *calloc(size_t __count, size_t __size) __result_use_check __alloc_size(1,2);
       ^~~~~~
p483.cpp:33:20: error: 'void std::free(void*)' conflicts with a previous declaration
 void free(void* ptr);
                    ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:151:7: note: previous declaration 'void free(void*)'
 void  free(void *);
       ^~~~
p483.cpp:34:25: error: 'void* std::malloc(std::size_t)' conflicts with a previous declaration
 void* malloc(size_t size);
                         ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:160:7: note: previous declaration 'void* malloc(size_t)'
 void *malloc(size_t __size) __result_use_check __alloc_size(1);
       ^~~~~~
p483.cpp:35:37: error: 'void* std::realloc(void*, std::size_t)' conflicts with a previous declaration
 void* realloc(void* ptr, size_t size);
                                     ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:168:7: note: previous declaration 'void* realloc(void*, size_t)'
 void *realloc(void *__ptr, size_t __size) __result_use_check __alloc_size(2);
       ^~~~~~~
p483.cpp:36:29: error: 'double std::atof(const char*)' conflicts with a previous declaration
 double atof(const char* nptr);
                             ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:139:9: note: previous declaration 'double atof(const char*)'
 double  atof(const char *);
         ^~~~
p483.cpp:37:26: error: 'int std::atoi(const char*)' conflicts with a previous declaration
 int atoi(const char* nptr);
                          ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:140:6: note: previous declaration 'int atoi(const char*)'
 int  atoi(const char *);
      ^~~~
p483.cpp:38:31: error: 'long int std::atol(const char*)' conflicts with a previous declaration
 long int atol(const char* nptr);
                               ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:141:7: note: previous declaration 'long int atol(const char*)'
 long  atol(const char *);
       ^~~~
p483.cpp:39:37: error: 'long long int std::atoll(const char*)' conflicts with a previous declaration
 long long int atoll(const char* nptr);
                                     ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:144:3: note: previous declaration 'long long int atoll(const char*)'
   atoll(const char *);
   ^~~~~
p483.cpp:40:46: error: 'double std::strtod(const char*, char**)' conflicts with a previous declaration
 double strtod(const char* nptr, char** endptr);
                                              ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:170:9: note: previous declaration 'double strtod(const char*, char**)'
 double  strtod(const char *, char **) __DARWIN_ALIAS(strtod);
         ^~~~~~
p483.cpp:41:45: error: 'float std::strtof(const char*, char**)' conflicts with a previous declaration
 float strtof(const char* nptr, char** endptr);
                                             ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:171:8: note: previous declaration 'float strtof(const char*, char**)'
 float  strtof(const char *, char **) __DARWIN_ALIAS(strtof);
        ^~~~~~
p483.cpp:42:52: error: 'long double std::strtold(const char*, char**)' conflicts with a previous declaration
 long double strtold(const char* nptr, char** endptr);
                                                    ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:174:3: note: previous declaration 'long double strtold(const char*, char**)'
   strtold(const char *, char **);
   ^~~~~~~
p483.cpp:43:58: error: 'long int std::strtol(const char*, char**, int)' conflicts with a previous declaration
 long int strtol(const char* nptr, char** endptr, int base);
                                                          ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:172:7: note: previous declaration 'long int strtol(const char*, char**, int)'
 long  strtol(const char *__str, char **__endptr, int __base);
       ^~~~~~
p483.cpp:44:64: error: 'long long int std::strtoll(const char*, char**, int)' conflicts with a previous declaration
 long long int strtoll(const char* nptr, char** endptr, int base);
                                                                ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:177:3: note: previous declaration 'long long int strtoll(const char*, char**, int)'
   strtoll(const char *__str, char **__endptr, int __base);
   ^~~~~~~
p483.cpp:45:68: error: 'long unsigned int std::strtoul(const char*, char**, int)' conflicts with a previous declaration
 unsigned long int strtoul(const char* nptr, char** endptr, int base);
                                                                    ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:180:3: note: previous declaration 'long unsigned int strtoul(const char*, char**, int)'
   strtoul(const char *__str, char **__endptr, int __base);
   ^~~~~~~
p483.cpp:46:74: error: 'long long unsigned int std::strtoull(const char*, char**, int)' conflicts with a previous declaration
 unsigned long long int strtoull(const char* nptr, char** endptr, int base);
                                                                          ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:183:3: note: previous declaration 'long long unsigned int strtoull(const char*, char**, int)'
   strtoull(const char *__str, char **__endptr, int __base);
   ^~~~~~~~
p483.cpp:48:34: error: 'int std::mblen(const char*, std::size_t)' conflicts with a previous declaration
 int mblen(const char* s, size_t n);
                                  ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:161:6: note: previous declaration 'int mblen(const char*, size_t)'
 int  mblen(const char *__s, size_t __n);
      ^~~~~
p483.cpp:49:49: error: 'int std::mbtowc(wchar_t*, const char*, std::size_t)' conflicts with a previous declaration
 int mbtowc(wchar_t* pwc, const char* s, size_t n);
                                                 ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:163:6: note: previous declaration 'int mbtowc(wchar_t*, const char*, size_t)'
 int  mbtowc(wchar_t * __restrict, const char * __restrict, size_t);
      ^~~~~~
p483.cpp:50:34: error: 'int std::wctomb(char*, wchar_t)' conflicts with a previous declaration
 int wctomb(char* s, wchar_t wchar);
                                  ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:200:6: note: previous declaration 'int wctomb(char*, wchar_t)'
 int  wctomb(char *, wchar_t);
      ^~~~~~
p483.cpp:51:55: error: 'std::size_t std::mbstowcs(wchar_t*, const char*, std::size_t)' conflicts with a previous declaration
 size_t mbstowcs(wchar_t* pwcs, const char* s, size_t n);
                                                       ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:162:9: note: previous declaration 'size_t mbstowcs(wchar_t*, const char*, size_t)'
 size_t  mbstowcs(wchar_t * __restrict , const char * __restrict, size_t);
         ^~~~~~~~
p483.cpp:52:55: error: 'std::size_t std::wcstombs(char*, const wchar_t*, std::size_t)' conflicts with a previous declaration
 size_t wcstombs(char* s, const wchar_t* pwcs, size_t n);
                                                       ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:199:9: note: previous declaration 'size_t wcstombs(char*, const wchar_t*, size_t)'
 size_t  wcstombs(char * __restrict, const wchar_t * __restrict, size_t);
         ^~~~~~~~
p483.cpp:57:41: error: 'void* std::bsearch(const void*, const void*, std::size_t, std::size_t, int (*)(const void*, const void*))' conflicts with a previous declaration
 int (*compar)(const void* , const void*));
                                         ^
p483.cpp:54:18: note: previous declaration 'void* bsearch(const void*, const void*, std::size_t, std::size_t, int (*)(const void*, const void*))'
 extern "C" void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
                  ^~~~~~~
p483.cpp:61:41: error: 'void std::qsort(void*, std::size_t, std::size_t, int (*)(const void*, const void*))' conflicts with a previous declaration
 int (*compar)(const void* , const void*));
                                         ^
p483.cpp:58:17: note: previous declaration 'void qsort(void*, std::size_t, std::size_t, int (*)(const void*, const void*))'
 extern "C" void qsort(void* base, size_t nmemb, size_t size,
                 ^~~~~
p483.cpp:63:10: error: 'int std::rand()' conflicts with a previous declaration
 int rand();
          ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:167:6: note: previous declaration 'int rand()'
 int  rand(void) __swift_unavailable("Use arc4random instead.");
      ^~~~
p483.cpp:64:29: error: 'void std::srand(unsigned int)' conflicts with a previous declaration
 void srand(unsigned int seed);
                             ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:169:7: note: previous declaration 'void srand(unsigned int)'
 void  srand(unsigned) __swift_unavailable("Use arc4random instead.");
       ^~~~~
p483.cpp:66:14: error: 'int std::abs(int)' conflicts with a previous declaration
 int abs(int j);
              ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:137:6: note: previous declaration 'int abs(int)'
 int  abs(int) __pure2;
      ^~~
p483.cpp:69:7: error: redeclaration 'float std::abs(float)' differs in 'constexpr' from previous declaration
 float abs(float j);
       ^~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:77:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/std_abs.h:74:3: note: previous declaration 'constexpr float std::abs(float)'
   abs(float __x)
   ^~~
p483.cpp:70:8: error: redeclaration 'double std::abs(double)' differs in 'constexpr' from previous declaration
 double abs(double j);
        ^~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:77:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/std_abs.h:70:3: note: previous declaration 'constexpr double std::abs(double)'
   abs(double __x)
   ^~~
p483.cpp:71:13: error: redeclaration 'long double std::abs(long double)' differs in 'constexpr' from previous declaration
 long double abs(long double j);
             ^~~
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:77:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/std_abs.h:78:3: note: previous declaration 'constexpr long double std::abs(long double)'
   abs(long double __x)
   ^~~
p483.cpp:72:25: error: 'long int std::labs(long int)' conflicts with a previous declaration
 long int labs(long int j);
                         ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:153:7: note: previous declaration 'long int labs(long int)'
 long  labs(long) __pure2;
       ^~~~
p483.cpp:73:36: error: 'long long int std::llabs(long long int)' conflicts with a previous declaration
 long long int llabs(long long int j);
                                    ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:157:3: note: previous declaration 'long long int llabs(long long int)'
   llabs(long long);
   ^~~~~
p483.cpp:74:31: error: 'div_t std::div(int, int)' conflicts with a previous declaration
 div_t div(int numer, int denom);
                               ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:149:8: note: previous declaration 'div_t div(int, int)'
 div_t  div(int, int) __pure2;
        ^~~
p483.cpp:76:53: error: 'lldiv_t std::div(long long int, long long int)' conflicts with a previous declaration
 lldiv_t div(long long int numer, long long int denom); // see 17.2
                                                     ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:207:3: note: previous declaration 'lldiv_t __gnu_cxx::div(long long int, long long int)'
   div(long long __n, long long __d)
   ^~~
p483.cpp:77:43: error: 'ldiv_t std::ldiv(long int, long int)' conflicts with a previous declaration
 ldiv_t ldiv(long int numer, long int denom);
                                           ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:154:9: note: previous declaration 'ldiv_t ldiv(long int, long int)'
 ldiv_t  ldiv(long, long) __pure2;
         ^~~~
p483.cpp:78:55: error: 'lldiv_t std::lldiv(long long int, long long int)' conflicts with a previous declaration
 lldiv_t lldiv(long long int numer, long long int denom);
                                                       ^
In file included from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/cstdlib:75:0,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ext/string_conversions.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/string:52,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/locale_classes.h:40,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/bits/ios_base.h:41,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ios:42,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.3.0_1/include/c++/7.3.0/iostream:39,
                 from p483.cpp:6:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:158:10: note: previous declaration 'lldiv_t lldiv(long long int, long long int)'
 lldiv_t  lldiv(long long, long long);
          ^~~~~

タブを2つの空白に変換しているスクリプトは下記。

a.sh
#!/bin/bash
astyle -s2 -c < $1.cpp > $1s2.cpp
cat $1s2.cpp

検討事項

clang++エラー2つ、g++エラーたくさん
役に立つまたは意味のある出力

参考資料

N4606 Working Draft 2016, ISO/IEC 14882, C++ standardのコード断片をコンパイルするためにしていること
https://qiita.com/kaizen_nagoya/items/a8d7ee2f2e29e76c19c1

コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)
https://qiita.com/kaizen_nagoya/items/74220c0577a512c2d7da

Clang/Clang++(LLVM) gcc/g++(GNU) コンパイラ警告等比較
https://qiita.com/kaizen_nagoya/items/9a82b958cc3aeef0403f

Qiitaに投稿するCのStyle例(暫定)
https://qiita.com/kaizen_nagoya/items/946df1528a6a1ef2bc0d

MISRA C++ 5-0-16
https://qiita.com/kaizen_nagoya/items/7df2d4e05db724752a74

C++ Templates Part1 BASICS Chapter 3. Class Templates 3.2 Use of Class Template Stack stack1test.cpp
https://qiita.com/kaizen_nagoya/items/cd5fc49106fad5a4e9ed

ISO/IEC TS 17961:2013 C Secure Coding Rules(1) All list(to be confirmed)
https://qiita.com/kaizen_nagoya/items/54e056195c4f11b850a1

C言語(C++)に対する誤解、曲解、無理解、爽快。
https://qiita.com/kaizen_nagoya/items/3f3992c9722c1cee2e3a

C Puzzle Bookの有り難み5つ、C言語規格及びCコンパイラの特性を認識
https://qiita.com/kaizen_nagoya/items/d89a48c1536a02ecdec9

'wchar.h' file not found で困った clang++ macOS
https://qiita.com/kaizen_nagoya/items/de15cd46d657517fac11

Open POSIX Test Suiteの使い方を調べはじめました
https://qiita.com/kaizen_nagoya/items/644d5e407f5faf96e6dc

MISRA-C 2012 Referenceに掲載している文献の入手可能性を確認
https://qiita.com/kaizen_nagoya/items/96dc8b125e462d5575bb

どうやって MISRA Example Suiteをコンパイルするか
https://qiita.com/kaizen_nagoya/items/fbdbff5ff696e2ca7f00

MISRA C まとめ #include
https://qiita.com/kaizen_nagoya/items/f1a79a7cbd281607c7c9

「C++完全理解ガイド」の同意できること上位10
https://qiita.com/kaizen_nagoya/items/aa5744e0c4a8618c7671

文書履歴

0.10 初稿 20180422

最後までおよみいただきありがとうございました。

いいね 💚、フォローをお願いします。

Thank you very much for reading to the last sentence.

Please press the like icon 💚 and follow me for your happy life.

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?