lex:如何覆盖YY_BUF_SIZE [英] lex : How to override YY_BUF_SIZE
问题描述
根据手册 YY_BUF_SIZE
是16K
,我们需要覆盖它.但是,该手册未指定如何覆盖它,也无法为此找到任何命令行选项.有人可以指出如何更改此设置吗?在生成的源中,YY_BUF_SIZE
的定义如下:
According to the manual YY_BUF_SIZE
is 16K
and we need to override it. However, the manual does not specify how to override it, nor could I find any command line option for this. Can someone please indicate how to change this. In the generated source YY_BUF_SIZE
is defined as follows:
#ifndef YY_BUF_SIZE
#define YY_BUF_SIZE 16384
#endif
所以在此之前可能有一种方法可以覆盖它.
so there may be a way to override it before this.
推荐答案
在您自己的代码中,只需将YY_BUF_SIZE定义为所需的任何值即可.只要您编译代码以使编译器首先看到您的定义,#ifndef防护将阻止设置默认值.
In your own code, simply #define YY_BUF_SIZE to whatever value you want. As long as you compile your code so the compiler sees your definition first, the #ifndef guard will prevent the default value from being set.
这篇关于lex:如何覆盖YY_BUF_SIZE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!