static const float complex
One of the following permutations of static const float complex
showed up in a code review at work today. It made me wonder which
permutations would compile. The answer: they all do. Have fun.
#include <stdio.h> #include <complex.h> /* #!/bin/usr/env python3 import itertools for perm in itertools.permutations(["static", "const", "float", "complex"]): print(" ".join(perm)) */ int main (void) { static const float complex static_const_float_complex = 0 + 1 * I; static const complex float static_const_complex_float = 0 + 1 * I; static float const complex static_float_const_complex = 0 + 1 * I; static float complex const static_float_complex_const = 0 + 1 * I; static complex const float static_complex_const_float = 0 + 1 * I; static complex float const static_complex_float_const = 0 + 1 * I; const static float complex const_static_float_complex = 0 + 1 * I; const static complex float const_static_complex_float = 0 + 1 * I; const float static complex const_float_static_complex = 0 + 1 * I; const float complex static const_float_complex_static = 0 + 1 * I; const complex static float const_complex_static_float = 0 + 1 * I; const complex float static const_complex_float_static = 0 + 1 * I; float static const complex float_static_const_complex = 0 + 1 * I; float static complex const float_static_complex_const = 0 + 1 * I; float const static complex float_const_static_complex = 0 + 1 * I; float const complex static float_const_complex_static = 0 + 1 * I; float complex static const float_complex_static_const = 0 + 1 * I; float complex const static float_complex_const_static = 0 + 1 * I; complex static const float complex_static_const_float = 0 + 1 * I; complex static float const complex_static_float_const = 0 + 1 * I; complex const static float complex_const_static_float = 0 + 1 * I; complex const float static complex_const_float_static = 0 + 1 * I; complex float static const complex_float_static_const = 0 + 1 * I; complex float const static complex_float_const_static = 0 + 1 * I; printf("static_const_float_complex: (%f,%f)\n", crealf(static_const_float_complex), cimagf(static_const_float_complex)); printf("static_const_complex_float: (%f,%f)\n", crealf(static_const_complex_float), cimagf(static_const_complex_float)); printf("static_float_const_complex: (%f,%f)\n", crealf(static_float_const_complex), cimagf(static_float_const_complex)); printf("static_float_complex_const: (%f,%f)\n", crealf(static_float_complex_const), cimagf(static_float_complex_const)); printf("static_complex_const_float: (%f,%f)\n", crealf(static_complex_const_float), cimagf(static_complex_const_float)); printf("static_complex_float_const: (%f,%f)\n", crealf(static_complex_float_const), cimagf(static_complex_float_const)); printf("const_static_float_complex: (%f,%f)\n", crealf(const_static_float_complex), cimagf(const_static_float_complex)); printf("const_static_complex_float: (%f,%f)\n", crealf(const_static_complex_float), cimagf(const_static_complex_float)); printf("const_float_static_complex: (%f,%f)\n", crealf(const_float_static_complex), cimagf(const_float_static_complex)); printf("const_float_complex_static: (%f,%f)\n", crealf(const_float_complex_static), cimagf(const_float_complex_static)); printf("const_complex_static_float: (%f,%f)\n", crealf(const_complex_static_float), cimagf(const_complex_static_float)); printf("const_complex_float_static: (%f,%f)\n", crealf(const_complex_float_static), cimagf(const_complex_float_static)); printf("float_static_const_complex: (%f,%f)\n", crealf(float_static_const_complex), cimagf(float_static_const_complex)); printf("float_static_complex_const: (%f,%f)\n", crealf(float_static_complex_const), cimagf(float_static_complex_const)); printf("float_const_static_complex: (%f,%f)\n", crealf(float_const_static_complex), cimagf(float_const_static_complex)); printf("float_const_complex_static: (%f,%f)\n", crealf(float_const_complex_static), cimagf(float_const_complex_static)); printf("float_complex_static_const: (%f,%f)\n", crealf(float_complex_static_const), cimagf(float_complex_static_const)); printf("float_complex_const_static: (%f,%f)\n", crealf(float_complex_const_static), cimagf(float_complex_const_static)); printf("complex_static_const_float: (%f,%f)\n", crealf(complex_static_const_float), cimagf(complex_static_const_float)); printf("complex_static_float_const: (%f,%f)\n", crealf(complex_static_float_const), cimagf(complex_static_float_const)); printf("complex_const_static_float: (%f,%f)\n", crealf(complex_const_static_float), cimagf(complex_const_static_float)); printf("complex_const_float_static: (%f,%f)\n", crealf(complex_const_float_static), cimagf(complex_const_float_static)); printf("complex_float_static_const: (%f,%f)\n", crealf(complex_float_static_const), cimagf(complex_float_static_const)); printf("complex_float_const_static: (%f,%f)\n", crealf(complex_float_const_static), cimagf(complex_float_const_static)); }
$ make gcc -Wall -Wpedantic -o scfc scfc.c -lm $ ./scfc static_const_float_complex: (0.000000,1.000000) static_const_complex_float: (0.000000,1.000000) static_float_const_complex: (0.000000,1.000000) static_float_complex_const: (0.000000,1.000000) static_complex_const_float: (0.000000,1.000000) static_complex_float_const: (0.000000,1.000000) const_static_float_complex: (0.000000,1.000000) const_static_complex_float: (0.000000,1.000000) const_float_static_complex: (0.000000,1.000000) const_float_complex_static: (0.000000,1.000000) const_complex_static_float: (0.000000,1.000000) const_complex_float_static: (0.000000,1.000000) float_static_const_complex: (0.000000,1.000000) float_static_complex_const: (0.000000,1.000000) float_const_static_complex: (0.000000,1.000000) float_const_complex_static: (0.000000,1.000000) float_complex_static_const: (0.000000,1.000000) float_complex_const_static: (0.000000,1.000000) complex_static_const_float: (0.000000,1.000000) complex_static_float_const: (0.000000,1.000000) complex_const_static_float: (0.000000,1.000000) complex_const_float_static: (0.000000,1.000000) complex_float_static_const: (0.000000,1.000000) complex_float_const_static: (0.000000,1.000000)