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

查看:15
本文介绍了如何使用 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?

推荐答案

查看Boost 预处理器 库,它允许您在预处理器中编写循环等等.

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天全站免登陆