我已经在代码中使用了很长时间了,我希望专家们对这是否是个好主意发表意见。
#!/bin/bash
bundle exec rake db:migrate
if [ $? -eq 0 ]
then
bundle exec rails $@
else
echo "Failure: migrations failed, please check application logs for more details." >&2
exit 1
fi
此宏是否可以安全地用于短路cout,cin之类的东西?它可能带来的危害大于潜在危害吗?
答案 0 :(得分:0)
不,这不是一个好主意。 C ++程序员希望阅读C ++,而不是某人决定炮制的某种组合语言。
在C ++中使用预处理器几乎总是一个糟糕的主意,因为几乎总是有更好的选择。
请参见Why are preprocessor macros evil and what are the alternatives?
请参见https://softwareengineering.stackexchange.com/questions/249767/is-it-a-good-idea-to-define-me-this