LoginSignup
0
0

astyle 使ってみた

Last updated at Posted at 2022-06-26

C++N4910:2022 Standard Working Draft on ISO/IEC 14882(0) sample code compile list
https://qiita.com/kaizen_nagoya/items/fc957ddddd402004bb91

C++コード断片をコンパイルできる形にしようとしている。

直したコードは、できれば整形して見やすくしたい。

残念だったのは、規定値でnamespaceを構造的にしないことかもしれない。

9.8.2.1 General [namespace.def.general] C++N4910:2022 (115) p228.cpp

算譜(source code)

p228.cpp
// 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 = "9.8.2.1 General [namespace.def.general] C++N4910:2022 (115) p228.cpp";
// 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 <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <coroutine>
#include <vector>
#include <complex>
#include <map>

using namespace std;

// Example 1
namespace Outer {
int i;
namespace Inner {
void f() {
    i++;    // Outer::i
}
int i;
void g() {
    i++;    // Inner::i
}
}
}
// [Example 2 :
namespace A::inline B::C {
int i2;
}
// The above has the same effect as:
namespace A2 {
inline namespace B2 {
namespace C2 {
int i2;
}
}
}
int main() {
    cout  <<  n4910 << endl;
    return EXIT_SUCCESS;
}

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

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

Thank you very much for reading to the last sentence.

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

0
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
0
0