Created
September 21, 2012 20:06
-
-
Save metaphox/3763588 to your computer and use it in GitHub Desktop.
random C thing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //以下は、c でも c++ でも同じ。 | |
| //X(x) になってるところは全て警告orエラーになる。 | |
| // http://d.hatena.ne.jp/cicupo2/ | |
| void foo(void*x){} | |
| #define C const | |
| #define X(x) /* x */ | |
| int main() | |
| { | |
| int * * p000; | |
| int * * C p001; | |
| int * C * p010; | |
| int * C * C p011; | |
| int C * * p100; | |
| int C * * C p101; | |
| int C * C * p110; | |
| int C * C * C p111; | |
| foo(p000[0]); foo(p000); foo(&p000); | |
| foo(p001[0]); foo(p001); X(foo(&p001)); | |
| foo(p010[0]); X(foo(p010)); foo(&p010); | |
| foo(p011[0]); X(foo(p011)); X(foo(&p011)); | |
| X(foo(p100[0])); foo(p100); foo(&p100); | |
| X(foo(p101[0])); foo(p101); X(foo(&p101)); | |
| X(foo(p110[0])); X(foo(p110)); foo(&p110); | |
| X(foo(p111[0])); X(foo(p111)); X(foo(&p111)); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment