[淼] 关于`weird-code`仓库
  • 板块灌水区
  • 楼主AMIRIOX無暝
  • 当前回复23
  • 已保存回复23
  • 发布时间2020/7/15 11:53
  • 上次更新2023/11/6 23:06:30
查看原帖
[淼] 关于`weird-code`仓库
320697
AMIRIOX無暝楼主2020/7/15 11:53

前几天写了个莫名其妙的主函数递归,

但是gist.GitHub.com被墙,

我就直接灵机一动, new了个仓库叫weird-code专门放一些奇怪的,很沙雕的(非标准的)代码,link:

https://github.com/AMIRIOX/weird-code

但由于本人才疏学浅(就是太菜了),只想出两个奇怪代码(有一个还是个梗),所以希望有大佬可以fork本仓库并提交pull request, 谢谢大佬

奇怪代码实例:

// Please do not run in strict mode
// % clang++ recursion.cpp -o rec.exe 
// clang++ version: 10.0.0
#include <iostream>
int main(int argc, char** argv) {
    std::cout << argc << " ";
    main(argc+1,nullptr); 
}

还有一个彩蛋就是快捷编译的cmpl.sh:

# If the tests folder does not exist, create it.
if [ ! -d "../tests" ]; then
  mkdir ../tests
fi

# Intercept file name without suffix
filename=$(echo $1 | cut -d . -f1)
# echo $filename

# Check the compiler and compile
if command -v clang++ >/dev/null 2>&1; then 
  clang++ $1 -o ../tests/$filename.exe 
else 
    echo -e 'no exists clang, check gcc...\n' 
    if command -v g++ >/dev/null 2>&1; then 
      g++ $1 -o ../tests/$filename.exe 
    else 
        echo 'no exists compiler'
	exit
    fi
fi
../tests/$filename.exe

违规自删, 希望大家能支持/kel

2020/7/15 11:53
加载中...