Open4

C/C++メモ

ultimatileultimatile

Cの組み込み複素数(_Complex)は組み込み浮動小数点数型に対してのみ標準で定義されている。
組み込み整数型に対する_Complexは非標準の実装依存で定義されている[1]。GCC/Clangともに使えるっぽい。

typedefで定義される<stdint.h>int8_tなどには整数型であっても_Complexは利用できない。
_Complexはtype specifierと呼ばれるものでtypedefに適用ができないかららしい。

https://stackoverflow.com/questions/46395458/complex-long-int

脚注
  1. char _ComplexもOK ↩︎

ultimatileultimatile

カレントディレクトリ以下のC++ファイルにclang-formatを全適用

fd '\.(cpp|hpp|cc|cxx|h)$' -x clang-format -i {}

-iはinplaceオプション

あるいは

find . -type f \( -name "*.cpp" -o -name "*.hpp" -o -name "*.cc" -o -name "*.cxx" -o -name "*.h" \) -exec clang-format -i {} +

\(...\)でターゲット条件のグループ化
{}が実行ターゲット、最後の+でターゲットを並べてまとめて実行