エンジニア夏休み企画
個人開発と読書感想文に焦点を当てたのは良い企画だと思った。
<この項は書きかけです。順次追記します。>
読書感想文
CコンパイラによるC言語規格の読書感想文として掲載しています。
コンパイル実験が、C++N4910に対する、G++とClang++による感想文だということご理解いただけると幸いです。
読書感想文は人間かAIだけが作るものとは限りません。
本(電子書籍を含む)を入力として、その内容に対する文字列を読書感想文として受け止めましょう。
元の文章をあり方、コンパイルできるように電子化しておくこと、コンパイラが解釈可能な断片の作り方など。
個人開発
【個人開発】 効率的な背景 <エンジニア夏休み企画>
Cコンパイラの試験を一人でもくもくとやっているのは個人開発の一つの姿です。
箱庭
箱庭もくもく会 #10 日時:2022/09/14(水) 17:30-19:30
はじめに(Introduction)
N4910 Working Draft, Standard for Programming Language C++
C++ n4910は、ISO/IEC JTC1 SC22 WG21の作業原案(Working Draft)です。
公式のISO/IEC 14882原本ではありません。
ISO/IEC JTC1 SC22 のWG21を含むいくつかのWGでは、可能な限り作業文書を公開し、幅広い意見を求めています。
ISO/IEC JTC1 SC7からISO/IEC JTC1 SC22リエゾンとして、2000年頃、C/C++の品質向上に貢献しようとした活動をしていたことがあります。その頃は、まだISO/IEC TS 17961の原案が出る前です。Cの精神が優勢で、セキュリティ対策は補助的な位置付けでした。ISO/IEC TS 17961の制定と、C/C++のライブラリ類の見直しと、C++の進化はどんどん進んでいきます。
進化の具合が、どちらに行こうとしているかは、コンパイルて実行させてみないとわかりません。C/C++の規格案の電子ファイルは、そのままコンパイルできる形式であるとよいと主張してきました。MISRA-C/C++, CERTC/C++でも同様です。MISRA-C/C++は、Example Suiteという形で、コード断片をコンパイルできる形で提供するようになりました。
一連の記事はコード断片をコンパイルできる形にする方法を検討してコンパイル、リンク、実行して、規格案の原文と処理系(g++, Clang++)との違いを確認し、技術内容を検討し、ISO/IEC JTC1 SC22 WG21にフィードバックするために用います。
また、CERT C++, MISRA C++等のコーディング標準のコード断片をコンパイルする際の参考にさせていただこうと考えています。CERT C++, MISRA C++が標準化の動きとの時間的なずれがあれば確認できれば幸いです。また、boostライブラリとの関連、Linux OS, 箱庭プロジェクト、g++(GCC), clang++(LLVM)との関係も調査中です。
何か、抜け漏れ、耳より情報がありましたらおしらせくださると幸いです。
背景(back ground)
C/C++でコンパイルエラーが出ると、途方にくれることがしばしばあります。
何回かに1回は、該当するエラーが検索できます。
ただ、条件が違っていて、そこでの修正方法では目的を達成しないこともしばしばです。いろいろな条件のコンパイルエラーとその対応方法について、広く記録することによって、いつか同じエラーに遭遇した時にやくに立つことを目指しています。
この半年の間で、三度、自分のネットでの記録に助けられたことがあります。
また過去に解決できなかった記録を10種類以上、最近になって解決できたことがあります。それは、主に次の3つの情報に基づいています。
cpprefjp - C++日本語リファレンス
コンパイラの実装状況
また
https://researchmap.jp/joub9b3my-1797580/#_1797580
に記載したサイトのお世話になっています。
作業方針(sequence)
Clang++では-std=c++03, C++2bの2種類
g++では-std=c++03, c++2bの2種類
でコンパイルし、
1)コンパイルエラーを収集する。
2)コンパイルエラーをなくす方法を検討する。
コンパイルエラーになる例を示すだけが目的のコードは、コンパイルエラーをなくすのではなく、コンパイルエラーの種類を収集するだけにする。
文法を示すのが目的のコード場合に、コンパイルエラーをなくすのに手間がかかる場合は、順次作業します。
3)リンクエラーをなくす方法を検討する。
文法を示すのが目的のコード場合に、リンクエラーをなくすのに手間がかかる場合は、順次作業します。
4)意味のある出力を作る。
コンパイル、リンクが通っても、意味のある出力を示そうとすると、コンパイル・リンクエラーが出て収拾できそうにない場合がある。順次作業します。
1)だけのものから4)まで進んだものと色々ある状態です。一歩でも前に進むご助言をお待ちしています。「検討事項」の欄に現状を記録するようにしています。
C++N4910:2022 Standard Working Draft on ISO/IEC 14882(0) sample code compile list
C++N4741, 2018 Standard Working Draft on ISO/IEC 14882 sample code compile list
C++N4606, 2016符号断片編纂一覧(example code compile list)
C++N4606, 2016 Working Draft 2016, ISO/IEC 14882, C++ standard(1) Example code compile list
https://qiita.com/kaizen_nagoya/items/df5d62c35bd6ed1c3d43/
C++N3242, 2011 sample code compile list on clang++ and g++
編纂器(Compiler)
clang++ --version
20220826 以前
Debian clang version 14.0.5-++20220610033153+c12386ae247c-1~exp1~20220610153237.151
Target: x86_64-pc-linux-gnu, Thread model: posix, InstalledDir: /usr/bin
20220827 以降
Debian clang version 14.0.6-++20220622053050+f28c006a5895-1~exp1~20220622173135.152
Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin
g++- --version
g++ (GCC) 12.1.0 Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
算譜(source code)
// C++N4910 Committee Draft, Standard for Programming Language C++
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4910.pdf
const char * n4910 = "";
// Debian clang version 14.0.5-++20220610033153+c12386ae247c-
// g++ (GCC) 12.1.0 Copyright (C) 2022 Free Software Foundation, Inc.
// Edited by Dr. OGAWA Kiyoshi. Compile procedure and results record.
// C++N4910:2022 Standard Working Draft on ISO/IEC 14882(0) sample code compile list
// https://qiita.com/kaizen_nagoya/items/fc957ddddd402004bb91
#include "N4910.h"
using namespace std;
// 31.13.1 Header <cstdio> synopsis [cstdio.syn]
namespace std {
// using size_t = //see 17.2.4;
// using FILE = see_below;
// using fpos_t = see_below;
}
// #define NULL see 17.2.3
// #define _IOFBF see below
// #define _IOLBF see below
// #define _IONBF see below
// #define BUFSIZ see below
// #define EOF see below}
// #define FOPEN_MAX see below
// #define FILENAME_MAX see below
// #define L_tmpnam see below
// #define SEEK_CUR see below
// #define SEEK_END see below
// #define SEEK_SET see below
// #define TMP_MAX see below
// #define stderr see below
// #define stdin see below
// #define stdout see below
namespace std {
int remove(const char* filename);
int rename(const char* old_p, const char* new_p);
FILE* tmpfile();
char* tmpnam(char* s);
int fclose(FILE* stream);
int fflush(FILE* stream);
FILE* fopen(const char* filename, const char* mode);
FILE* freopen(const char* filename, const char* mode, FILE* stream);
void setbuf(FILE* stream, char* buf);
int setvbuf(FILE* stream, char* buf, int mode, size_t size);
int fprintf(FILE* stream, const char* format, ...);
int fscanf(FILE* stream, const char* format, ...);
int printf(const char* format, ...);
int scanf(const char* format, ...);
int snprintf(char* s, size_t n, const char* format, ...);
int sprintf(char* s, const char* format, ...);
int sscanf(const char* s, const char* format, ...);
int vfprintf(FILE* stream, const char* format, va_list arg);
int vfscanf(FILE* stream, const char* format, va_list arg);
int vprintf(const char* format, va_list arg);
int vscanf(const char* format, va_list arg);
int vsnprintf(char* s, size_t n, const char* format, va_list arg);
int vsprintf(char* s, const char* format, va_list arg);
int vsscanf(const char* s, const char* format, va_list arg);
int fgetc(FILE* stream);
char* fgets(char* s, int n, FILE* stream);
int fputc(int c, FILE* stream);
int fputs(const char* s, FILE* stream);
int getc(FILE* stream);
int getchar();
int putc(int c, FILE* stream);
int putchar(int c);
int puts(const char* s);
int ungetc(int c, FILE* stream);
size_t fread(void* ptr, size_t size, size_t nmemb, FILE* stream);
size_t fwrite(const void* ptr, size_t size, size_t nmemb, FILE* stream);
int fgetpos(FILE* stream, fpos_t* pos);
int fseek(FILE* stream, long int offset, int whence);
int fsetpos(FILE* stream, const fpos_t* pos);
long int ftell(FILE* stream);
void rewind(FILE* stream);
void clearerr(FILE* stream);
int feof(FILE* stream);
int ferror(FILE* stream);
void perror(const char* s);
}
// The contents and meaning of the header <cstdio> are the same as the C standard library header <stdio.h>.
// Calls to the function tmpnam with an argument that is a null pointer value may introduce a data race (16.4.6.10) with other calls to tmpnam with an argument that is a null pointer value. See also: ISO C 7.21
// 31.13.2 Header <cinttypes> synopsis [cinttypes.syn]
#include <cstdint> // see 17.4.2
namespace std {
using imaxdiv_t = see_below;
intmax_t imaxabs(intmax_t j);
imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
intmax_t strtoimax(const char* nptr, char** endptr, int base);
uintmax_t strtoumax(const char* nptr, char** endptr, int base);
intmax_t wcstoimax(const wchar_t* nptr, wchar_t** endptr, int base);
uintmax_t wcstoumax(const wchar_t* nptr, wchar_t** endptr, int base);
intmax_t abs(intmax_t);
imaxdiv_t div(intmax_t, intmax_t);
// #define PRIdN see below
// #define PRIiN see below
// #define PRIoN see below
// #define PRIuN see below
// #define PRIxN see below
// #define PRIXN see below
// #define SCNdN see below
// #define SCNiN see below
// #define SCNoN see below
// #define SCNuN see below
// #define SCNxN see below
// #define PRIdLEASTN see below
// #define PRIiLEASTN see below
// #define PRIoLEASTN see below
// #define PRIuLEASTN see below
// #define PRIxLEASTN see below
// #define PRIXLEASTN see below
// #define SCNdLEASTN see below
// #define SCNiLEASTN see below
// #define SCNoLEASTN see below
// #define SCNuLEASTN see below
// #define SCNxLEASTN see below
// #define PRIdFASTN see below
// #define PRIiFASTN see below
// #define PRIoFASTN see below
// #define PRIuFASTN see below
// #define PRIxFASTN see below
// #define PRIXFASTN see below
// #define SCNdFASTN see below
// #define SCNiFASTN see below
// #define SCNoFASTN see below
// #define SCNuFASTN see below
// #define SCNxFASTN see below
// #define PRIdMAX see below
// #define PRIiMAX see below
// #define PRIoMAX see below
// #define PRIuMAX see below
// #define PRIxMAX see below
// #define PRIXMAX see below
// #define SCNdMAX see below
// #define SCNiMAX see below
// #define SCNoMAX see below
// #define SCNuMAX see below
// #define SCNxMAX see below
// #define PRIdPTR see below
// #define PRIiPTR see below
// optional, see below // optional, see below
}
// #define PRIoPTR see below
// #define PRIuPTR see below
// #define PRIxPTR see below
// #define PRIXPTR see below
// #define SCNdPTR see below
// #define SCNiPTR see below
// #define SCNoPTR see below
// #define SCNuPTR see below
// #define SCNxPTR see below
// The contents and meaning of the header <cinttypes> are the same as the C standard library header <inttypes.h>, with the following changes:
// — The header <cinttypes> includes the header <cstdint> (17.4.2) instead of <stdint.h>, and
// — if and only if the type intmax_t designates an extended integer type (6.8.2), the following function signatures are added:
intmax_t abs(intmax_t);
imaxdiv_t div(intmax_t, intmax_t);
// which shall have the same semantics as the function signatures intmax_t imaxabs(intmax_t) and imaxdiv_t imaxdiv(intmax_t, intmax_t), respectively.
// See also: ISO C 7.8
// Each of the PRI macros listed in this subclause is defined if and only if the implementation defines the corresponding typedef-name in 17.4.2. Each of the SCN macros listed in this subclause is defined if and only if the implementation defines the corresponding typedef-name in 17.4.2 and has a suitable fscanf length modifier for the type.
int main() {
cout << n4910 << endl;
return EXIT_SUCCESS;
}
編纂・実行結果(compile and go)
$ clang++ p1622.cpp -std=03 -o p1622l -I. -Wall
In file included from p1622.cpp:10:
In file included from ./N4910.h:11:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/atomic:38:
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/c++0x_warning.h:32:2: error: This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \
^
p1622.cpp:37:12: error: declaration conflicts with target of using declaration already in scope
int remove(const char* filename);
^
/usr/include/stdio.h:146:12: note: target of using declaration
extern int remove (const char *__filename) __THROW;
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:131:11: note: using declaration
using ::remove;
^
p1622.cpp:38:12: error: declaration conflicts with target of using declaration already in scope
int rename(const char* old_p, const char* new_p);
^
/usr/include/stdio.h:148:12: note: target of using declaration
extern int rename (const char *__old, const char *__new) __THROW;
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:132:11: note: using declaration
using ::rename;
^
p1622.cpp:39:14: error: declaration conflicts with target of using declaration already in scope
FILE* tmpfile();
^
/usr/include/stdio.h:173:14: note: target of using declaration
extern FILE *tmpfile (void) __wur;
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:139:11: note: using declaration
using ::tmpfile;
^
p1622.cpp:40:14: error: declaration conflicts with target of using declaration already in scope
char* tmpnam(char* s);
^
/usr/include/stdio.h:187:14: note: target of using declaration
extern char *tmpnam (char *__s) __THROW __wur;
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:141:11: note: using declaration
using ::tmpnam;
^
p1622.cpp:41:12: error: declaration conflicts with target of using declaration already in scope
int fclose(FILE* stream);
^
/usr/include/stdio.h:213:12: note: target of using declaration
extern int fclose (FILE *__stream);
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:102:11: note: using declaration
using ::fclose;
^
p1622.cpp:42:12: error: declaration conflicts with target of using declaration already in scope
int fflush(FILE* stream);
^
/usr/include/stdio.h:218:12: note: target of using declaration
extern int fflush (FILE *__stream);
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:105:11: note: using declaration
using ::fflush;
^
p1622.cpp:43:14: error: declaration conflicts with target of using declaration already in scope
FILE* fopen(const char* filename, const char* mode);
^
/usr/include/stdio.h:246:14: note: target of using declaration
extern FILE *fopen (const char *__restrict __filename,
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:109:11: note: using declaration
using ::fopen;
^
p1622.cpp:44:14: error: declaration conflicts with target of using declaration already in scope
FILE* freopen(const char* filename, const char* mode, FILE* stream);
^
/usr/include/stdio.h:252:14: note: target of using declaration
extern FILE *freopen (const char *__restrict __filename,
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:114:11: note: using declaration
using ::freopen;
^
p1622.cpp:45:13: error: declaration conflicts with target of using declaration already in scope
void setbuf(FILE* stream, char* buf);
^
/usr/include/stdio.h:304:13: note: target of using declaration
extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:135:11: note: using declaration
using ::setbuf;
^
p1622.cpp:46:12: error: declaration conflicts with target of using declaration already in scope
int setvbuf(FILE* stream, char* buf, int mode, size_t size);
^
/usr/include/stdio.h:308:12: note: target of using declaration
extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:136:11: note: using declaration
using ::setvbuf;
^
p1622.cpp:47:12: error: declaration conflicts with target of using declaration already in scope
int fprintf(FILE* stream, const char* format, ...);
^
/usr/include/stdio.h:326:12: note: target of using declaration
extern int fprintf (FILE *__restrict __stream,
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:110:11: note: using declaration
using ::fprintf;
^
p1622.cpp:48:12: error: declaration conflicts with target of using declaration already in scope
int fscanf(FILE* stream, const char* format, ...);
^
/usr/include/stdio.h:391:12: note: target of using declaration
extern int fscanf (FILE *__restrict __stream,
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:115:11: note: using declaration
using ::fscanf;
^
p1622.cpp:49:12: error: declaration conflicts with target of using declaration already in scope
int printf(const char* format, ...);
^
/usr/include/stdio.h:332:12: note: target of using declaration
extern int printf (const char *__restrict __format, ...);
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:127:11: note: using declaration
using ::printf;
^
p1622.cpp:50:12: error: declaration conflicts with target of using declaration already in scope
int scanf(const char* format, ...);
^
/usr/include/stdio.h:397:12: note: target of using declaration
extern int scanf (const char *__restrict __format, ...) __wur;
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:134:11: note: using declaration
using ::scanf;
^
p1622.cpp:51:12: error: declaration conflicts with target of using declaration already in scope
int snprintf(char* s, size_t n, const char* format, ...);
^
/usr/include/stdio.h:354:12: note: target of using declaration
extern int snprintf (char *__restrict __s, size_t __maxlen,
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:185:22: note: using declaration
using ::__gnu_cxx::snprintf;
^
p1622.cpp:52:12: error: declaration conflicts with target of using declaration already in scope
int sprintf(char* s, const char* format, ...);
^
/usr/include/stdio.h:334:12: note: target of using declaration
extern int sprintf (char *__restrict __s,
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:137:11: note: using declaration
using ::sprintf;
^
p1622.cpp:53:12: error: declaration conflicts with target of using declaration already in scope
int sscanf(const char* s, const char* format, ...);
^
/usr/include/stdio.h:399:12: note: target of using declaration
extern int sscanf (const char *__restrict __s,
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:138:11: note: using declaration
using ::sscanf;
^
p1622.cpp:54:12: error: declaration conflicts with target of using declaration already in scope
int vfprintf(FILE* stream, const char* format, va_list arg);
^
/usr/include/stdio.h:341:12: note: target of using declaration
extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:144:11: note: using declaration
using ::vfprintf;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
$ clang++ p1622.cpp -std=2b -o p1622l -I. -Wall
p1622.cpp:37:12: error: declaration conflicts with target of using declaration already in scope
int remove(const char* filename);
^
/usr/include/stdio.h:146:12: note: target of using declaration
extern int remove (const char *__filename) __THROW;
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:131:11: note: using declaration
using ::remove;
^
p1622.cpp:38:12: error: declaration conflicts with target of using declaration already in scope
int rename(const char* old_p, const char* new_p);
^
/usr/include/stdio.h:148:12: note: target of using declaration
extern int rename (const char *__old, const char *__new) __THROW;
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:132:11: note: using declaration
using ::rename;
^
p1622.cpp:39:14: error: declaration conflicts with target of using declaration already in scope
FILE* tmpfile();
^
/usr/include/stdio.h:173:14: note: target of using declaration
extern FILE *tmpfile (void) __wur;
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:139:11: note: using declaration
using ::tmpfile;
^
p1622.cpp:40:14: error: declaration conflicts with target of using declaration already in scope
char* tmpnam(char* s);
^
/usr/include/stdio.h:187:14: note: target of using declaration
extern char *tmpnam (char *__s) __THROW __wur;
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:141:11: note: using declaration
using ::tmpnam;
^
p1622.cpp:41:12: error: declaration conflicts with target of using declaration already in scope
int fclose(FILE* stream);
^
/usr/include/stdio.h:213:12: note: target of using declaration
extern int fclose (FILE *__stream);
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:102:11: note: using declaration
using ::fclose;
^
p1622.cpp:42:12: error: declaration conflicts with target of using declaration already in scope
int fflush(FILE* stream);
^
/usr/include/stdio.h:218:12: note: target of using declaration
extern int fflush (FILE *__stream);
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:105:11: note: using declaration
using ::fflush;
^
p1622.cpp:43:14: error: declaration conflicts with target of using declaration already in scope
FILE* fopen(const char* filename, const char* mode);
^
/usr/include/stdio.h:246:14: note: target of using declaration
extern FILE *fopen (const char *__restrict __filename,
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:109:11: note: using declaration
using ::fopen;
^
p1622.cpp:44:14: error: declaration conflicts with target of using declaration already in scope
FILE* freopen(const char* filename, const char* mode, FILE* stream);
^
/usr/include/stdio.h:252:14: note: target of using declaration
extern FILE *freopen (const char *__restrict __filename,
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:114:11: note: using declaration
using ::freopen;
^
p1622.cpp:45:13: error: declaration conflicts with target of using declaration already in scope
void setbuf(FILE* stream, char* buf);
^
/usr/include/stdio.h:304:13: note: target of using declaration
extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:135:11: note: using declaration
using ::setbuf;
^
p1622.cpp:46:12: error: declaration conflicts with target of using declaration already in scope
int setvbuf(FILE* stream, char* buf, int mode, size_t size);
^
/usr/include/stdio.h:308:12: note: target of using declaration
extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:136:11: note: using declaration
using ::setvbuf;
^
p1622.cpp:47:12: error: declaration conflicts with target of using declaration already in scope
int fprintf(FILE* stream, const char* format, ...);
^
/usr/include/stdio.h:326:12: note: target of using declaration
extern int fprintf (FILE *__restrict __stream,
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:110:11: note: using declaration
using ::fprintf;
^
p1622.cpp:48:12: error: declaration conflicts with target of using declaration already in scope
int fscanf(FILE* stream, const char* format, ...);
^
/usr/include/stdio.h:407:24: note: target of using declaration
extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:115:11: note: using declaration
using ::fscanf;
^
p1622.cpp:49:12: error: declaration conflicts with target of using declaration already in scope
int printf(const char* format, ...);
^
/usr/include/stdio.h:332:12: note: target of using declaration
extern int printf (const char *__restrict __format, ...);
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:127:11: note: using declaration
using ::printf;
^
p1622.cpp:50:12: error: declaration conflicts with target of using declaration already in scope
int scanf(const char* format, ...);
^
/usr/include/stdio.h:410:24: note: target of using declaration
extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:134:11: note: using declaration
using ::scanf;
^
p1622.cpp:51:12: error: declaration conflicts with target of using declaration already in scope
int snprintf(char* s, size_t n, const char* format, ...);
^
/usr/include/stdio.h:354:12: note: target of using declaration
extern int snprintf (char *__restrict __s, size_t __maxlen,
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:185:22: note: using declaration
using ::__gnu_cxx::snprintf;
^
p1622.cpp:52:12: error: declaration conflicts with target of using declaration already in scope
int sprintf(char* s, const char* format, ...);
^
/usr/include/stdio.h:334:12: note: target of using declaration
extern int sprintf (char *__restrict __s,
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:137:11: note: using declaration
using ::sprintf;
^
p1622.cpp:53:12: error: declaration conflicts with target of using declaration already in scope
int sscanf(const char* s, const char* format, ...);
^
/usr/include/stdio.h:412:28: note: target of using declaration
extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:138:11: note: using declaration
using ::sscanf;
^
p1622.cpp:54:12: error: declaration conflicts with target of using declaration already in scope
int vfprintf(FILE* stream, const char* format, va_list arg);
^
/usr/include/stdio.h:341:12: note: target of using declaration
extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:144:11: note: using declaration
using ::vfprintf;
^
p1622.cpp:55:12: error: declaration conflicts with target of using declaration already in scope
int vfscanf(FILE* stream, const char* format, va_list arg);
^
/usr/include/stdio.h:451:24: note: target of using declaration
extern int __REDIRECT (vfscanf,
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstdio:186:22: note: using declaration
using ::__gnu_cxx::vfscanf;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
$ g++ p1622.cpp -std=03 -o p1622g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
from N4910.h:11,
from p1622.cpp:10:
/usr/local/include/c++/12.1.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
32 | #error This file requires compiler and library support \
| ^~~~~
p1622.cpp:37:39: error: 'int std::remove(const char*)' conflicts with a previous declaration
37 | int remove(const char* filename);
| ^
In file included from /usr/local/include/c++/12.1.0/cstdio:42,
from N4910.h:3:
/usr/include/stdio.h:146:12: note: previous declaration 'int remove(const char*)'
146 | extern int remove (const char *__filename) __THROW;
| ^~~~~~
p1622.cpp:38:55: error: 'int std::rename(const char*, const char*)' conflicts with a previous declaration
38 | int rename(const char* old_p, const char* new_p);
| ^
/usr/include/stdio.h:148:12: note: previous declaration 'int rename(const char*, const char*)'
148 | extern int rename (const char *__old, const char *__new) __THROW;
| ^~~~~~
p1622.cpp:39:22: error: 'FILE* std::tmpfile()' conflicts with a previous declaration
39 | FILE* tmpfile();
| ^
/usr/include/stdio.h:173:14: note: previous declaration 'FILE* tmpfile()'
173 | extern FILE *tmpfile (void) __wur;
| ^~~~~~~
p1622.cpp:40:28: error: 'char* std::tmpnam(char*)' conflicts with a previous declaration
40 | char* tmpnam(char* s);
| ^
/usr/include/stdio.h:187:14: note: previous declaration 'char* tmpnam(char*)'
187 | extern char *tmpnam (char *__s) __THROW __wur;
| ^~~~~~
p1622.cpp:41:31: error: 'int std::fclose(FILE*)' conflicts with a previous declaration
41 | int fclose(FILE* stream);
| ^
/usr/include/stdio.h:213:12: note: previous declaration 'int fclose(FILE*)'
213 | extern int fclose (FILE *__stream);
| ^~~~~~
p1622.cpp:42:31: error: 'int std::fflush(FILE*)' conflicts with a previous declaration
42 | int fflush(FILE* stream);
| ^
/usr/include/stdio.h:218:12: note: previous declaration 'int fflush(FILE*)'
218 | extern int fflush (FILE *__stream);
| ^~~~~~
p1622.cpp:43:58: error: 'FILE* std::fopen(const char*, const char*)' conflicts with a previous declaration
43 | FILE* fopen(const char* filename, const char* mode);
| ^
/usr/include/stdio.h:246:14: note: previous declaration 'FILE* fopen(const char*, const char*)'
246 | extern FILE *fopen (const char *__restrict __filename,
| ^~~~~
p1622.cpp:44:74: error: 'FILE* std::freopen(const char*, const char*, FILE*)' conflicts with a previous declaration
44 | FILE* freopen(const char* filename, const char* mode, FILE* stream);
| ^
/usr/include/stdio.h:252:14: note: previous declaration 'FILE* freopen(const char*, const char*, FILE*)'
252 | extern FILE *freopen (const char *__restrict __filename,
| ^~~~~~~
p1622.cpp:45:43: error: 'void std::setbuf(FILE*, char*)' conflicts with a previous declaration
45 | void setbuf(FILE* stream, char* buf);
| ^
/usr/include/stdio.h:304:13: note: previous declaration 'void setbuf(FILE*, char*)'
304 | extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;
| ^~~~~~
p1622.cpp:46:66: error: 'int std::setvbuf(FILE*, char*, int, size_t)' conflicts with a previous declaration
46 | int setvbuf(FILE* stream, char* buf, int mode, size_t size);
| ^
/usr/include/stdio.h:308:12: note: previous declaration 'int setvbuf(FILE*, char*, int, size_t)'
308 | extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
| ^~~~~~~
p1622.cpp:47:57: error: 'int std::fprintf(FILE*, const char*, ...)' conflicts with a previous declaration
47 | int fprintf(FILE* stream, const char* format, ...);
| ^
/usr/include/stdio.h:326:12: note: previous declaration 'int fprintf(FILE*, const char*, ...)'
326 | extern int fprintf (FILE *__restrict __stream,
| ^~~~~~~
p1622.cpp:48:56: error: 'int std::fscanf(FILE*, const char*, ...)' conflicts with a previous declaration
48 | int fscanf(FILE* stream, const char* format, ...);
| ^
/usr/include/stdio.h:391:12: note: previous declaration 'int fscanf(FILE*, const char*, ...)'
391 | extern int fscanf (FILE *__restrict __stream,
| ^~~~~~
p1622.cpp:49:42: error: 'int std::printf(const char*, ...)' conflicts with a previous declaration
49 | int printf(const char* format, ...);
| ^
/usr/include/stdio.h:332:12: note: previous declaration 'int printf(const char*, ...)'
332 | extern int printf (const char *__restrict __format, ...);
| ^~~~~~
p1622.cpp:50:41: error: 'int std::scanf(const char*, ...)' conflicts with a previous declaration
50 | int scanf(const char* format, ...);
| ^
/usr/include/stdio.h:397:12: note: previous declaration 'int scanf(const char*, ...)'
397 | extern int scanf (const char *__restrict __format, ...) __wur;
| ^~~~~
p1622.cpp:51:63: error: 'int std::snprintf(char*, size_t, const char*, ...)' conflicts with a previous declaration
51 | int snprintf(char* s, size_t n, const char* format, ...);
| ^
/usr/include/stdio.h:354:12: note: previous declaration 'int snprintf(char*, size_t, const char*, ...)'
354 | extern int snprintf (char *__restrict __s, size_t __maxlen,
| ^~~~~~~~
p1622.cpp:52:52: error: 'int std::sprintf(char*, const char*, ...)' conflicts with a previous declaration
52 | int sprintf(char* s, const char* format, ...);
| ^
/usr/include/stdio.h:334:12: note: previous declaration 'int sprintf(char*, const char*, ...)'
334 | extern int sprintf (char *__restrict __s,
| ^~~~~~~
p1622.cpp:53:57: error: 'int std::sscanf(const char*, const char*, ...)' conflicts with a previous declaration
53 | int sscanf(const char* s, const char* format, ...);
| ^
/usr/include/stdio.h:399:12: note: previous declaration 'int sscanf(const char*, const char*, ...)'
399 | extern int sscanf (const char *__restrict __s,
| ^~~~~~
p1622.cpp:54:66: error: 'int std::vfprintf(FILE*, const char*, __va_list_tag*)' conflicts with a previous declaration
54 | int vfprintf(FILE* stream, const char* format, va_list arg);
| ^
/usr/include/stdio.h:341:12: note: previous declaration 'int vfprintf(FILE*, const char*, __va_list_tag*)'
341 | extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
| ^~~~~~~~
p1622.cpp:55:65: error: 'int std::vfscanf(FILE*, const char*, __va_list_tag*)' conflicts with a previous declaration
55 | int vfscanf(FILE* stream, const char* format, va_list arg);
| ^
/usr/include/stdio.h:432:12: note: previous declaration 'int vfscanf(FILE*, const char*, __va_list_tag*)'
432 | extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
| ^~~~~~~
p1622.cpp:56:51: error: 'int std::vprintf(const char*, __va_list_tag*)' conflicts with a previous declaration
56 | int vprintf(const char* format, va_list arg);
| ^
/usr/include/stdio.h:347:12: note: previous declaration 'int vprintf(const char*, __va_list_tag*)'
347 | extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
| ^~~~~~~
p1622.cpp:57:50: error: 'int std::vscanf(const char*, __va_list_tag*)' conflicts with a previous declaration
57 | int vscanf(const char* format, va_list arg);
| ^
/usr/include/stdio.h:440:12: note: previous declaration 'int vscanf(const char*, __va_list_tag*)'
440 | extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
| ^~~~~~
p1622.cpp:58:72: error: 'int std::vsnprintf(char*, size_t, const char*, __va_list_tag*)' conflicts with a previous declaration
58 | int vsnprintf(char* s, size_t n, const char* format, va_list arg);
| ^
/usr/include/stdio.h:358:12: note: previous declaration 'int vsnprintf(char*, size_t, const char*, __va_list_tag*)'
358 | extern int vsnprintf (char *__restrict __s, size_t __maxlen,
| ^~~~~~~~~
p1622.cpp:59:61: error: 'int std::vsprintf(char*, const char*, __va_list_tag*)' conflicts with a previous declaration
59 | int vsprintf(char* s, const char* format, va_list arg);
| ^
/usr/include/stdio.h:349:12: note: previous declaration 'int vsprintf(char*, const char*, __va_list_tag*)'
349 | extern int vsprintf (char *__restrict __s, const char *__restrict __format,
| ^~~~~~~~
p1622.cpp:60:66: error: 'int std::vsscanf(const char*, const char*, __va_list_tag*)' conflicts with a previous declaration
60 | int vsscanf(const char* s, const char* format, va_list arg);
| ^
/usr/include/stdio.h:444:12: note: previous declaration 'int vsscanf(const char*, const char*, __va_list_tag*)'
444 | extern int vsscanf (const char *__restrict __s,
| ^~~~~~~
p1622.cpp:61:30: error: 'int std::fgetc(FILE*)' conflicts with a previous declaration
61 | int fgetc(FILE* stream);
| ^
/usr/include/stdio.h:485:12: note: previous declaration 'int fgetc(FILE*)'
485 | extern int fgetc (FILE *__stream);
| ^~~~~
p1622.cpp:62:48: error: 'char* std::fgets(char*, int, FILE*)' conflicts with a previous declaration
62 | char* fgets(char* s, int n, FILE* stream);
| ^
/usr/include/stdio.h:564:14: note: previous declaration 'char* fgets(char*, int, FILE*)'
564 | extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
| ^~~~~
p1622.cpp:63:37: error: 'int std::fputc(int, FILE*)' conflicts with a previous declaration
63 | int fputc(int c, FILE* stream);
| ^
/usr/include/stdio.h:521:12: note: previous declaration 'int fputc(int, FILE*)'
521 | extern int fputc (int __c, FILE *__stream);
| ^~~~~
p1622.cpp:64:45: error: 'int std::fputs(const char*, FILE*)' conflicts with a previous declaration
64 | int fputs(const char* s, FILE* stream);
| ^
/usr/include/stdio.h:626:12: note: previous declaration 'int fputs(const char*, FILE*)'
626 | extern int fputs (const char *__restrict __s, FILE *__restrict __stream);
| ^~~~~
p1622.cpp:65:29: error: 'int std::getc(FILE*)' conflicts with a previous declaration
65 | int getc(FILE* stream);
| ^
/usr/include/stdio.h:486:12: note: previous declaration 'int getc(FILE*)'
486 | extern int getc (FILE *__stream);
| ^~~~
p1622.cpp:66:20: error: 'int std::getchar()' conflicts with a previous declaration
66 | int getchar();
| ^
/usr/include/stdio.h:492:12: note: previous declaration 'int getchar()'
492 | extern int getchar (void);
| ^~~~~~~
p1622.cpp:67:36: error: 'int std::putc(int, FILE*)' conflicts with a previous declaration
67 | int putc(int c, FILE* stream);
| ^
/usr/include/stdio.h:522:12: note: previous declaration 'int putc(int, FILE*)'
522 | extern int putc (int __c, FILE *__stream);
| ^~~~
p1622.cpp:68:25: error: 'int std::putchar(int)' conflicts with a previous declaration
68 | int putchar(int c);
| ^
/usr/include/stdio.h:528:12: note: previous declaration 'int putchar(int)'
528 | extern int putchar (int __c);
| ^~~~~~~
p1622.cpp:69:30: error: 'int std::puts(const char*)' conflicts with a previous declaration
69 | int puts(const char* s);
| ^
/usr/include/stdio.h:632:12: note: previous declaration 'int puts(const char*)'
632 | extern int puts (const char *__s);
| ^~~~
p1622.cpp:70:38: error: 'int std::ungetc(int, FILE*)' conflicts with a previous declaration
70 | int ungetc(int c, FILE* stream);
| ^
/usr/include/stdio.h:639:12: note: previous declaration 'int ungetc(int, FILE*)'
639 | extern int ungetc (int __c, FILE *__stream);
| ^~~~~~
p1622.cpp:71:71: error: 'std::size_t std::fread(void*, size_t, size_t, FILE*)' conflicts with a previous declaration
71 | size_t fread(void* ptr, size_t size, size_t nmemb, FILE* stream);
| ^
/usr/include/stdio.h:646:15: note: previous declaration 'size_t fread(void*, size_t, size_t, FILE*)'
646 | extern size_t fread (void *__restrict __ptr, size_t __size,
| ^~~~~
p1622.cpp:72:78: error: 'std::size_t std::fwrite(const void*, size_t, size_t, FILE*)' conflicts with a previous declaration
72 | size_t fwrite(const void* ptr, size_t size, size_t nmemb, FILE* stream);
| ^
/usr/include/stdio.h:652:15: note: previous declaration 'size_t fwrite(const void*, size_t, size_t, FILE*)'
652 | extern size_t fwrite (const void *__restrict __ptr, size_t __size,
| ^~~~~~
p1622.cpp:73:45: error: 'int std::fgetpos(FILE*, fpos_t*)' conflicts with a previous declaration
73 | int fgetpos(FILE* stream, fpos_t* pos);
| ^
/usr/include/stdio.h:731:12: note: previous declaration 'int fgetpos(FILE*, fpos_t*)'
731 | extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
| ^~~~~~~
p1622.cpp:74:59: error: 'int std::fseek(FILE*, long int, int)' conflicts with a previous declaration
74 | int fseek(FILE* stream, long int offset, int whence);
| ^
/usr/include/stdio.h:684:12: note: previous declaration 'int fseek(FILE*, long int, int)'
684 | extern int fseek (FILE *__stream, long int __off, int __whence);
| ^~~~~
p1622.cpp:75:51: error: 'int std::fsetpos(FILE*, const fpos_t*)' conflicts with a previous declaration
75 | int fsetpos(FILE* stream, const fpos_t* pos);
| ^
/usr/include/stdio.h:736:12: note: previous declaration 'int fsetpos(FILE*, const fpos_t*)'
736 | extern int fsetpos (FILE *__stream, const fpos_t *__pos);
| ^~~~~~~
p1622.cpp:76:35: error: 'long int std::ftell(FILE*)' conflicts with a previous declaration
76 | long int ftell(FILE* stream);
| ^
/usr/include/stdio.h:689:17: note: previous declaration 'long int ftell(FILE*)'
689 | extern long int ftell (FILE *__stream) __wur;
| ^~~~~
p1622.cpp:77:32: error: 'void std::rewind(FILE*)' conflicts with a previous declaration
77 | void rewind(FILE* stream);
| ^
/usr/include/stdio.h:694:13: note: previous declaration 'void rewind(FILE*)'
694 | extern void rewind (FILE *__stream);
| ^~~~~~
p1622.cpp:78:34: error: 'void std::clearerr(FILE*)' conflicts with a previous declaration
78 | void clearerr(FILE* stream);
| ^
/usr/include/stdio.h:757:13: note: previous declaration 'void clearerr(FILE*)'
757 | extern void clearerr (FILE *__stream) __THROW;
| ^~~~~~~~
p1622.cpp:79:29: error: 'int std::feof(FILE*)' conflicts with a previous declaration
79 | int feof(FILE* stream);
| ^
/usr/include/stdio.h:759:12: note: previous declaration 'int feof(FILE*)'
759 | extern int feof (FILE *__stream) __THROW __wur;
| ^~~~
p1622.cpp:80:31: error: 'int std::ferror(FILE*)' conflicts with a previous declaration
80 | int ferror(FILE* stream);
| ^
/usr/include/stdio.h:761:12: note: previous declaration 'int ferror(FILE*)'
761 | extern int ferror (FILE *__stream) __THROW __wur;
| ^~~~~~
p1622.cpp:81:33: error: 'void std::perror(const char*)' conflicts with a previous declaration
81 | void perror(const char* s);
| ^
/usr/include/stdio.h:775:13: note: previous declaration 'void perror(const char*)'
775 | extern void perror (const char *__s);
| ^~~~~~
p1622.cpp:88:7: error: expected nested-name-specifier before 'imaxdiv_t'
88 | using imaxdiv_t = see_below;
| ^~~~~~~~~
p1622.cpp:89:5: error: 'intmax_t' does not name a type; did you mean 'int8_t'?
89 | intmax_t imaxabs(intmax_t j);
| ^~~~~~~~
| int8_t
p1622.cpp:90:5: error: 'imaxdiv_t' does not name a type
90 | imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
| ^~~~~~~~~
p1622.cpp:91:5: error: 'intmax_t' does not name a type; did you mean 'int8_t'?
91 | intmax_t strtoimax(const char* nptr, char** endptr, int base);
| ^~~~~~~~
| int8_t
p1622.cpp:92:5: error: 'uintmax_t' does not name a type
92 | uintmax_t strtoumax(const char* nptr, char** endptr, int base);
| ^~~~~~~~~
p1622.cpp:93:5: error: 'intmax_t' does not name a type; did you mean 'int8_t'?
93 | intmax_t wcstoimax(const wchar_t* nptr, wchar_t** endptr, int base);
| ^~~~~~~~
| int8_t
p1622.cpp:94:5: error: 'uintmax_t' does not name a type
94 | uintmax_t wcstoumax(const wchar_t* nptr, wchar_t** endptr, int base);
| ^~~~~~~~~
p1622.cpp:95:3: error: 'intmax_t' does not name a type; did you mean 'int8_t'?
95 | intmax_t abs(intmax_t);
| ^~~~~~~~
| int8_t
p1622.cpp:96:3: error: 'imaxdiv_t' does not name a type
96 | imaxdiv_t div(intmax_t, intmax_t);
| ^~~~~~~~~
p1622.cpp:157:6: error: 'intmax_t' does not name a type; did you mean 'int8_t'?
157 | intmax_t abs(intmax_t);
| ^~~~~~~~
| int8_t
p1622.cpp:158:6: error: 'imaxdiv_t' does not name a type
158 | imaxdiv_t div(intmax_t, intmax_t);
| ^~~~~~~~~
$ g++ p1622.cpp -std=2b -o p1622g -I. -Wall
p1622.cpp:37:39: error: 'int std::remove(const char*)' conflicts with a previous declaration
37 | int remove(const char* filename);
| ^
In file included from /usr/local/include/c++/12.1.0/cstdio:42,
from /usr/local/include/c++/12.1.0/ext/string_conversions.h:43,
from /usr/local/include/c++/12.1.0/bits/basic_string.h:3960,
from /usr/local/include/c++/12.1.0/string:53,
from /usr/local/include/c++/12.1.0/bits/locale_classes.h:40,
from /usr/local/include/c++/12.1.0/bits/ios_base.h:41,
from /usr/local/include/c++/12.1.0/ios:42,
from /usr/local/include/c++/12.1.0/ostream:38,
from /usr/local/include/c++/12.1.0/iostream:39,
from N4910.h:2,
from p1622.cpp:10:
/usr/include/stdio.h:146:12: note: previous declaration 'int remove(const char*)'
146 | extern int remove (const char *__filename) __THROW;
| ^~~~~~
p1622.cpp:38:55: error: 'int std::rename(const char*, const char*)' conflicts with a previous declaration
38 | int rename(const char* old_p, const char* new_p);
| ^
/usr/include/stdio.h:148:12: note: previous declaration 'int rename(const char*, const char*)'
148 | extern int rename (const char *__old, const char *__new) __THROW;
| ^~~~~~
p1622.cpp:39:22: error: 'FILE* std::tmpfile()' conflicts with a previous declaration
39 | FILE* tmpfile();
| ^
/usr/include/stdio.h:173:14: note: previous declaration 'FILE* tmpfile()'
173 | extern FILE *tmpfile (void) __wur;
| ^~~~~~~
p1622.cpp:40:28: error: 'char* std::tmpnam(char*)' conflicts with a previous declaration
40 | char* tmpnam(char* s);
| ^
/usr/include/stdio.h:187:14: note: previous declaration 'char* tmpnam(char*)'
187 | extern char *tmpnam (char *__s) __THROW __wur;
| ^~~~~~
p1622.cpp:41:31: error: 'int std::fclose(FILE*)' conflicts with a previous declaration
41 | int fclose(FILE* stream);
| ^
/usr/include/stdio.h:213:12: note: previous declaration 'int fclose(FILE*)'
213 | extern int fclose (FILE *__stream);
| ^~~~~~
p1622.cpp:42:31: error: 'int std::fflush(FILE*)' conflicts with a previous declaration
42 | int fflush(FILE* stream);
| ^
/usr/include/stdio.h:218:12: note: previous declaration 'int fflush(FILE*)'
218 | extern int fflush (FILE *__stream);
| ^~~~~~
p1622.cpp:43:58: error: 'FILE* std::fopen(const char*, const char*)' conflicts with a previous declaration
43 | FILE* fopen(const char* filename, const char* mode);
| ^
/usr/include/stdio.h:246:14: note: previous declaration 'FILE* fopen(const char*, const char*)'
246 | extern FILE *fopen (const char *__restrict __filename,
| ^~~~~
p1622.cpp:44:74: error: 'FILE* std::freopen(const char*, const char*, FILE*)' conflicts with a previous declaration
44 | FILE* freopen(const char* filename, const char* mode, FILE* stream);
| ^
/usr/include/stdio.h:252:14: note: previous declaration 'FILE* freopen(const char*, const char*, FILE*)'
252 | extern FILE *freopen (const char *__restrict __filename,
| ^~~~~~~
p1622.cpp:45:43: error: 'void std::setbuf(FILE*, char*)' conflicts with a previous declaration
45 | void setbuf(FILE* stream, char* buf);
| ^
/usr/include/stdio.h:304:13: note: previous declaration 'void setbuf(FILE*, char*)'
304 | extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;
| ^~~~~~
p1622.cpp:46:66: error: 'int std::setvbuf(FILE*, char*, int, size_t)' conflicts with a previous declaration
46 | int setvbuf(FILE* stream, char* buf, int mode, size_t size);
| ^
/usr/include/stdio.h:308:12: note: previous declaration 'int setvbuf(FILE*, char*, int, size_t)'
308 | extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
| ^~~~~~~
p1622.cpp:47:57: error: 'int std::fprintf(FILE*, const char*, ...)' conflicts with a previous declaration
47 | int fprintf(FILE* stream, const char* format, ...);
| ^
/usr/include/stdio.h:326:12: note: previous declaration 'int fprintf(FILE*, const char*, ...)'
326 | extern int fprintf (FILE *__restrict __stream,
| ^~~~~~~
p1622.cpp:48:56: error: 'int std::fscanf(FILE*, const char*, ...)' conflicts with a previous declaration
48 | int fscanf(FILE* stream, const char* format, ...);
| ^
In file included from /usr/include/features.h:461,
from /usr/local/include/c++/12.1.0/x86_64-linux-gnu/bits/os_defines.h:39,
from /usr/local/include/c++/12.1.0/x86_64-linux-gnu/bits/c++config.h:655,
from /usr/local/include/c++/12.1.0/cstddef:49,
from N4910.h:1:
/usr/include/stdio.h:407:12: note: previous declaration 'int fscanf(FILE*, const char*, ...)'
407 | extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
| ^~~~~~~~~~
p1622.cpp:49:42: error: 'int std::printf(const char*, ...)' conflicts with a previous declaration
49 | int printf(const char* format, ...);
| ^
/usr/include/stdio.h:332:12: note: previous declaration 'int printf(const char*, ...)'
332 | extern int printf (const char *__restrict __format, ...);
| ^~~~~~
p1622.cpp:50:41: error: 'int std::scanf(const char*, ...)' conflicts with a previous declaration
50 | int scanf(const char* format, ...);
| ^
/usr/include/stdio.h:410:12: note: previous declaration 'int scanf(const char*, ...)'
410 | extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
| ^~~~~~~~~~
p1622.cpp:51:63: error: 'int std::snprintf(char*, size_t, const char*, ...)' conflicts with a previous declaration
51 | int snprintf(char* s, size_t n, const char* format, ...);
| ^
/usr/include/stdio.h:354:12: note: previous declaration 'int snprintf(char*, size_t, const char*, ...)'
354 | extern int snprintf (char *__restrict __s, size_t __maxlen,
| ^~~~~~~~
p1622.cpp:52:52: error: 'int std::sprintf(char*, const char*, ...)' conflicts with a previous declaration
52 | int sprintf(char* s, const char* format, ...);
| ^
/usr/include/stdio.h:334:12: note: previous declaration 'int sprintf(char*, const char*, ...)'
334 | extern int sprintf (char *__restrict __s,
| ^~~~~~~
p1622.cpp:53:57: error: 'int std::sscanf(const char*, const char*, ...)' conflicts with a previous declaration
53 | int sscanf(const char* s, const char* format, ...);
| ^
/usr/include/stdio.h:412:12: note: previous declaration 'int sscanf(const char*, const char*, ...)'
412 | extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
| ^~~~~~~~~~~~~~
p1622.cpp:54:66: error: 'int std::vfprintf(FILE*, const char*, __va_list_tag*)' conflicts with a previous declaration
54 | int vfprintf(FILE* stream, const char* format, va_list arg);
| ^
/usr/include/stdio.h:341:12: note: previous declaration 'int vfprintf(FILE*, const char*, __va_list_tag*)'
341 | extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
| ^~~~~~~~
p1622.cpp:55:65: error: 'int std::vfscanf(FILE*, const char*, __va_list_tag*)' conflicts with a previous declaration
55 | int vfscanf(FILE* stream, const char* format, va_list arg);
| ^
/usr/include/stdio.h:451:12: note: previous declaration 'int vfscanf(FILE*, const char*, __va_list_tag*)'
451 | extern int __REDIRECT (vfscanf,
| ^~~~~~~~~~
p1622.cpp:56:51: error: 'int std::vprintf(const char*, __va_list_tag*)' conflicts with a previous declaration
56 | int vprintf(const char* format, va_list arg);
| ^
/usr/include/stdio.h:347:12: note: previous declaration 'int vprintf(const char*, __va_list_tag*)'
347 | extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
| ^~~~~~~
p1622.cpp:57:50: error: 'int std::vscanf(const char*, __va_list_tag*)' conflicts with a previous declaration
57 | int vscanf(const char* format, va_list arg);
| ^
/usr/include/stdio.h:456:12: note: previous declaration 'int vscanf(const char*, __va_list_tag*)'
456 | extern int __REDIRECT (vscanf, (const char *__restrict __format,
| ^~~~~~~~~~
p1622.cpp:58:72: error: 'int std::vsnprintf(char*, size_t, const char*, __va_list_tag*)' conflicts with a previous declaration
58 | int vsnprintf(char* s, size_t n, const char* format, va_list arg);
| ^
/usr/include/stdio.h:358:12: note: previous declaration 'int vsnprintf(char*, size_t, const char*, __va_list_tag*)'
358 | extern int vsnprintf (char *__restrict __s, size_t __maxlen,
| ^~~~~~~~~
p1622.cpp:59:61: error: 'int std::vsprintf(char*, const char*, __va_list_tag*)' conflicts with a previous declaration
59 | int vsprintf(char* s, const char* format, va_list arg);
| ^
/usr/include/stdio.h:349:12: note: previous declaration 'int vsprintf(char*, const char*, __va_list_tag*)'
349 | extern int vsprintf (char *__restrict __s, const char *__restrict __format,
| ^~~~~~~~
p1622.cpp:60:66: error: 'int std::vsscanf(const char*, const char*, __va_list_tag*)' conflicts with a previous declaration
60 | int vsscanf(const char* s, const char* format, va_list arg);
| ^
/usr/include/stdio.h:459:12: note: previous declaration 'int vsscanf(const char*, const char*, __va_list_tag*)'
459 | extern int __REDIRECT_NTH (vsscanf,
| ^~~~~~~~~~~~~~
p1622.cpp:61:30: error: 'int std::fgetc(FILE*)' conflicts with a previous declaration
61 | int fgetc(FILE* stream);
| ^
/usr/include/stdio.h:485:12: note: previous declaration 'int fgetc(FILE*)'
485 | extern int fgetc (FILE *__stream);
| ^~~~~
p1622.cpp:62:48: error: 'char* std::fgets(char*, int, FILE*)' conflicts with a previous declaration
62 | char* fgets(char* s, int n, FILE* stream);
| ^
/usr/include/stdio.h:564:14: note: previous declaration 'char* fgets(char*, int, FILE*)'
564 | extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
| ^~~~~
p1622.cpp:63:37: error: 'int std::fputc(int, FILE*)' conflicts with a previous declaration
63 | int fputc(int c, FILE* stream);
| ^
/usr/include/stdio.h:521:12: note: previous declaration 'int fputc(int, FILE*)'
521 | extern int fputc (int __c, FILE *__stream);
| ^~~~~
p1622.cpp:64:45: error: 'int std::fputs(const char*, FILE*)' conflicts with a previous declaration
64 | int fputs(const char* s, FILE* stream);
| ^
/usr/include/stdio.h:626:12: note: previous declaration 'int fputs(const char*, FILE*)'
626 | extern int fputs (const char *__restrict __s, FILE *__restrict __stream);
| ^~~~~
p1622.cpp:65:29: error: 'int std::getc(FILE*)' conflicts with a previous declaration
65 | int getc(FILE* stream);
| ^
/usr/include/stdio.h:486:12: note: previous declaration 'int getc(FILE*)'
486 | extern int getc (FILE *__stream);
| ^~~~
p1622.cpp:66:20: error: 'int std::getchar()' conflicts with a previous declaration
66 | int getchar();
| ^
/usr/include/stdio.h:492:12: note: previous declaration 'int getchar()'
492 | extern int getchar (void);
| ^~~~~~~
p1622.cpp:67:36: error: 'int std::putc(int, FILE*)' conflicts with a previous declaration
67 | int putc(int c, FILE* stream);
| ^
/usr/include/stdio.h:522:12: note: previous declaration 'int putc(int, FILE*)'
522 | extern int putc (int __c, FILE *__stream);
| ^~~~
p1622.cpp:68:25: error: 'int std::putchar(int)' conflicts with a previous declaration
68 | int putchar(int c);
| ^
/usr/include/stdio.h:528:12: note: previous declaration 'int putchar(int)'
528 | extern int putchar (int __c);
| ^~~~~~~
p1622.cpp:69:30: error: 'int std::puts(const char*)' conflicts with a previous declaration
69 | int puts(const char* s);
| ^
/usr/include/stdio.h:632:12: note: previous declaration 'int puts(const char*)'
632 | extern int puts (const char *__s);
| ^~~~
p1622.cpp:70:38: error: 'int std::ungetc(int, FILE*)' conflicts with a previous declaration
70 | int ungetc(int c, FILE* stream);
| ^
/usr/include/stdio.h:639:12: note: previous declaration 'int ungetc(int, FILE*)'
639 | extern int ungetc (int __c, FILE *__stream);
| ^~~~~~
p1622.cpp:71:71: error: 'std::size_t std::fread(void*, size_t, size_t, FILE*)' conflicts with a previous declaration
71 | size_t fread(void* ptr, size_t size, size_t nmemb, FILE* stream);
| ^
/usr/include/stdio.h:646:15: note: previous declaration 'size_t fread(void*, size_t, size_t, FILE*)'
646 | extern size_t fread (void *__restrict __ptr, size_t __size,
| ^~~~~
p1622.cpp:72:78: error: 'std::size_t std::fwrite(const void*, size_t, size_t, FILE*)' conflicts with a previous declaration
72 | size_t fwrite(const void* ptr, size_t size, size_t nmemb, FILE* stream);
| ^
/usr/include/stdio.h:652:15: note: previous declaration 'size_t fwrite(const void*, size_t, size_t, FILE*)'
652 | extern size_t fwrite (const void *__restrict __ptr, size_t __size,
| ^~~~~~
p1622.cpp:73:45: error: 'int std::fgetpos(FILE*, fpos_t*)' conflicts with a previous declaration
73 | int fgetpos(FILE* stream, fpos_t* pos);
| ^
/usr/include/stdio.h:731:12: note: previous declaration 'int fgetpos(FILE*, fpos_t*)'
731 | extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
| ^~~~~~~
p1622.cpp:74:59: error: 'int std::fseek(FILE*, long int, int)' conflicts with a previous declaration
74 | int fseek(FILE* stream, long int offset, int whence);
| ^
/usr/include/stdio.h:684:12: note: previous declaration 'int fseek(FILE*, long int, int)'
684 | extern int fseek (FILE *__stream, long int __off, int __whence);
| ^~~~~
p1622.cpp:75:51: error: 'int std::fsetpos(FILE*, const fpos_t*)' conflicts with a previous declaration
75 | int fsetpos(FILE* stream, const fpos_t* pos);
| ^
/usr/include/stdio.h:736:12: note: previous declaration 'int fsetpos(FILE*, const fpos_t*)'
736 | extern int fsetpos (FILE *__stream, const fpos_t *__pos);
| ^~~~~~~
p1622.cpp:76:35: error: 'long int std::ftell(FILE*)' conflicts with a previous declaration
76 | long int ftell(FILE* stream);
| ^
/usr/include/stdio.h:689:17: note: previous declaration 'long int ftell(FILE*)'
689 | extern long int ftell (FILE *__stream) __wur;
| ^~~~~
p1622.cpp:77:32: error: 'void std::rewind(FILE*)' conflicts with a previous declaration
77 | void rewind(FILE* stream);
| ^
/usr/include/stdio.h:694:13: note: previous declaration 'void rewind(FILE*)'
694 | extern void rewind (FILE *__stream);
| ^~~~~~
p1622.cpp:78:34: error: 'void std::clearerr(FILE*)' conflicts with a previous declaration
78 | void clearerr(FILE* stream);
| ^
/usr/include/stdio.h:757:13: note: previous declaration 'void clearerr(FILE*)'
757 | extern void clearerr (FILE *__stream) __THROW;
| ^~~~~~~~
p1622.cpp:79:29: error: 'int std::feof(FILE*)' conflicts with a previous declaration
79 | int feof(FILE* stream);
| ^
/usr/include/stdio.h:759:12: note: previous declaration 'int feof(FILE*)'
759 | extern int feof (FILE *__stream) __THROW __wur;
| ^~~~
p1622.cpp:80:31: error: 'int std::ferror(FILE*)' conflicts with a previous declaration
80 | int ferror(FILE* stream);
| ^
/usr/include/stdio.h:761:12: note: previous declaration 'int ferror(FILE*)'
761 | extern int ferror (FILE *__stream) __THROW __wur;
| ^~~~~~
p1622.cpp:81:33: error: 'void std::perror(const char*)' conflicts with a previous declaration
81 | void perror(const char* s);
| ^
/usr/include/stdio.h:775:13: note: previous declaration 'void perror(const char*)'
775 | extern void perror (const char *__s);
| ^~~~~~
p1622.cpp:88:19: error: 'see_below' does not name a type
88 | using imaxdiv_t = see_below;
| ^~~~~~~~~
p1622.cpp:90:5: error: 'imaxdiv_t' does not name a type
90 | imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
| ^~~~~~~~~
p1622.cpp:96:3: error: 'imaxdiv_t' does not name a type
96 | imaxdiv_t div(intmax_t, intmax_t);
| ^~~~~~~~~
p1622.cpp:158:6: error: 'imaxdiv_t' does not name a type
158 | imaxdiv_t div(intmax_t, intmax_t);
| ^~~~~~~~~
検討事項(agenda)
コンパイルエラーを取るか、コンパイルエラーの理由を解説する。
応用例1 AUTOSAR C++
AUTOSARでC++のコーディング標準を作っている。
MISRA-C++コーディング標準の改訂をまたずに、C++14に対応したかったためかもしれない。
Autosar Guidelines C++14 example code compile list
MISRA C++, AUTOSAR C++について
応用例2 MISRA C/C++
MISRA C まとめ #include
MISRA C++ 5-0-16
応用例3 CERT C/C++
SEI CERT C++ Coding Standard AA. Bibliography 確認中。
MISRA C/C++, AUTOSAR C++, CERT C/C++とC/C++工業標準をコンパイルする
応用例4 箱庭
箱庭もくもく会 #10 日時:2022/09/14(水) 17:30-19:30
箱庭ではUnityをはじめC++を使っているらしい。
ここでコンパイルしたコードと同じようなコードを使っているか、
ここで出たコンパイルエラーと同じようなエラーがでたかを
いろいろな版のコンパイラでコンパイルして確認していく。
この項目は、箱庭プロジェクトを市場分析の対象として、原則的には、箱庭プロジェクトの外部から分析し、外部から箱庭の広告宣伝のための戦略会議を仮想した結果、仮想「箱庭もくもく会」を開催してみることを企画するものである。
一切の内容は、箱庭プロジェクト、Athrill, TOPPERSとは無関係である。
一(いち)参加データアナリストの、個人的なつぶやきです。
仮想戦略会議「箱庭」
お盆には「箱庭」記事を書きましょう「もくもく会」の題材になる(1)
お盆には「箱庭」記事を書きましょう「もくもく会」の題材になる(2)
自己参考資料(self reference)
関連する自己参照以外は、こちらの先頭に移転。
C言語(C++)に対する誤解、曲解、無理解、爽快。
#include "N4910.h"
C++N4910資料の改善点
dockerにclang
docker gnu(gcc/g++) and llvm(clang/clang++)
コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)
C++N4910:2022 tag follower 300人超えました。ありがとうございます。
astyle 使ってみた
<この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。>
文書履歴(document history)
ver. 0.01 初稿 20220905