首頁>Club>
不限編譯器以及C++ 版本不能引用第三方庫不允許所有語句寫在一行裡這種操作認為80個字元的編譯錯誤資訊為一行不得使用宏(#include #define #ifdef等)必須使用可以正常工作的編譯器(自己寫一個只會報錯的不算)一行不得多於80個字元
8
回覆列表
  • 1 # 飛翔的天地

    使用遞迴模板理論上可以造出無限多個錯誤。

    // https://gcc.godbolt.org/z/97v858

    template <int N>

    struct Fuck {

    int arr[-N];

    Fuck<N + 1> next;

    };

    Fuck<1> f;

    <source>: In instantiation of "struct Fuck<1>":

    <source>:8:9: required from here

    <source>:3:9: error: narrowing conversion of "-1" from "int" to "long unsigned int" [-Wnarrowing]

    3 | int arr[-N];

    | ^~~

    <source>:3:9: error: size "-1" of array is negative

    <source>: In instantiation of "struct Fuck<2>":

    <source>:4:17: required from "struct Fuck<1>"

    <source>:8:9: required from here

    <source>:3:9: error: narrowing conversion of "-2" from "int" to "long unsigned int" [-Wnarrowing]

    <source>:3:9: error: size "-2" of array is negative

    <source>: In instantiation of "struct Fuck<3>":

    <source>:4:17: recursively required from "struct Fuck<2>"

    <source>:4:17: required from "struct Fuck<1>"

    <source>:8:9: required from here

    <source>:3:9: error: narrowing conversion of "-3" from "int" to "long unsigned int" [-Wnarrowing]

    <source>:3:9: error: size "-3" of array is negative

    <source>: In instantiation of "struct Fuck<4>":

    <source>:4:17: recursively required from "struct Fuck<2>"

    <source>:4:17: required from "struct Fuck<1>"

    <source>:8:9: required from here

    <source>:3:9: error: narrowing conversion of "-4" from "int" to "long unsigned int" [-Wnarrowing]

    <source>:3:9: error: size "-4" of array is negative

    <source>: In instantiation of "struct Fuck<5>":

    <source>:4:17: recursively required from "struct Fuck<2>"

    <source>:4:17: required from "struct Fuck<1>"

    <source>:8:9: required from here

    <source>:3:9: error: narrowing conversion of "-5" from "int" to "long unsigned int" [-Wnarrowing]

    <source>:3:9: error: size "-5" of array is negative

    <source>: In instantiation of "struct Fuck<6>":

    <source>:4:17: recursively required from "struct Fuck<2>"

    <source>:4:17: required from "struct Fuck<1>"

    <source>:8:9: required from here

    <source>:3:9: error: narrowing conversion of "-6" from "int" to "long unsigned int" [-Wnarrowing]

    <source>:3:9: error: size "-6" of array is negative

    <source>: In instantiation of "struct Fuck<7>":

    <source>:4:17: recursively required from "struct Fuck<2>"

    <source>:4:17: required from "struct Fuck<1>"

    <source>:8:9: required from here

    <source>:3:9: error: narrowing conversion of "-7" from "int" to "long unsigned int" [-Wnarrowing]

    <source>:3:9: error: size "-7" of array is negative

    <source>: In instantiation of "struct Fuck<8>":

    <source>:4:17: recursively required from "struct Fuck<2>"

    <source>:4:17: required from "struct Fuck<1>"

    <source>:8:9: required from here

    <source>:3:9: error: narrowing conversion of "-8" from "int" to "long unsigned int" [-Wnarrowing]

    <source>:3:9: error: size "-8" of array is negative

    <source>: In instantiation of "struct Fuck<9>":

    <source>:4:17: recursively required from "struct Fuck<2>"

    <source>:4:17: required from "struct Fuck<1>"

    <source>:8:9: required from here

    <source>:3:9: error: narrowing conversion of "-9" from "int" to "long unsigned int" [-Wnarrowing]

    <source>:3:9: error: size "-9" of array is negative

    <source>: In instantiation of "struct Fuck<10>":

    <source>:4:17: recursively required from "struct Fuck<2>"

    <source>:4:17: required from "struct Fuck<1>"

    <source>:8:9: required from here

    <source>:3:9: error: narrowing conversion of "-10" from "int" to "long unsigned int" [-Wnarrowing]

    <source>:3:9: error: size "-10" of array is negative

    ……

  • 中秋節和大豐收的關聯?
  • 怎麼哄孩子效果最好?