如何用C预处理器编写while循环? [英] How to write a while loop with the C preprocessor?

查看:84
本文介绍了如何用C预处理器编写while循环?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是从教育/黑客的角度提出这个问题的,(我真的不想这样编码)。

I am asking this question from an educational/hacking point of view, (I wouldn't really want to code like this).

是否有可能实现仅使用 C 预处理程序指令进行while循环。我知道宏不能递归扩展,那么如何实现呢?

Is it possible to implement a while loop only using C preprocessor directives. I understand that macros cannot be expanded recursively, so how would this be accomplished?

推荐答案

看看增强预处理器库,该库可让您在预处理器中编写循环,还有更多。

Take a look at the Boost preprocessor library, which allows you to write loops in the preprocessor, and much more.

这篇关于如何用C预处理器编写while循环?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆