regcmp警告:不正确的指针/整数组合:op" =" [英] regcmp warning: improper pointer/integer combination: op "="

查看:107
本文介绍了regcmp警告:不正确的指针/整数组合:op" ="的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述






如果我不包含< libgen.h>我在下面的regcmp电话中得到warnig:


警告:指针/整数组合不当:op" ="


但如果我包括它警告没有显示,但他们的程序编译

罚款。


显示的警告是什么?


谢谢,

Jose Luis。


Hi,

If I don''t include <libgen.h> I get then warnig below in regcmp call:

warning: improper pointer/integer combination: op "="

but if I include it the warning is not shown, but them program compiles
fine.

What is the warning shown ?

Thanks,
Jose Luis.

推荐答案

乔********************** @ yahoo.es 写道:


如果我不包括< libgen.h>然后我在regcmp调用中得到warnig警告:

警告:指针/整数组合不正确:op" ="

但如果我包含警告,则不会显示警告,但他们的程序编译好了。

显示的是什么警告?

谢谢,何塞路易斯。
Hi,

If I don''t include <libgen.h> I get then warnig below in regcmp call:

warning: improper pointer/integer combination: op "="

but if I include it the warning is not shown, but them program compiles
fine.

What is the warning shown ?

Thanks,
Jose Luis.




在C中,如果原型不为

编译器所知,则所有函数都返回一个int。


如果你有一个函数返回如下指针:


char * fn(void);


您可以在代码中执行此操作而不会出现问题:


char * a = fn();


现在,如果编译器没有看到原型,那么fn函数是
$假设b $ b返回一个整数,该整数被赋值给char char指针

a。将一个整数赋值给一个指针并不是一个好主意,即使它工作正常,也需要
,所以编译器会向你发出警告。


解决方案:


编译时包含所有必需的头文件。


jacob



In C all functions return an int if the prototype is not known to the
compiler.

If you have a function that returns a pointer like:

char *fn(void);

you can do this in your code without problems:

char *a = fn();

Now, if the compiler doesn''t see the prototype, the fn function is
assumed to return an integer, that gets assigned to char char pointer
a. Assignment of an integer to a pointer is not a very good idea,
even if "it works", so the compiler warns you about it.

Solution:

DO INCLUDE all necessary header files when compiling.

jacob


jo ************ **********@yahoo.es 写道:

如果我不包括< libgen.h>然后我在regcmp调用中得到warnig警告:

警告:指针/整数组合不正确:op" ="

但如果我包含警告,则不会显示警告,但他们的程序编译好了。

显示的是什么警告?

If I don''t include <libgen.h> I get then warnig below in regcmp call:

warning: improper pointer/integer combination: op "="

but if I include it the warning is not shown, but them program
compiles fine.

What is the warning shown ?




C中没有这样的标准包含文件,也没有任何像regcmp这样的例行程序。您必须显示这些代码才能获得任何合理的答案。


-

"如果你想要要通过groups.google.com发布后续内容,请不要使用

损坏的回复链接在文章的底部。点击

" show options"在文章的顶部,然后点击

回复在文章标题的底部。 - Keith Thompson



There is no such standard include file in C, nor is there any such
routine as regcmp. You will have to show the code for these to
receive any reasonable answer.

--
"If you want to post a followup via groups.google.com, don''t use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson


jo ********************** @ yahoo.es 写道:
你好,

如果我不包括< libgen.h>然后我在regcmp调用中得到warnig警告:

警告:指针/整数组合不正确:op" ="

但如果我包含警告,则不会显示警告,但是他们的程序编译好了。

显示的警告是什么?
Hi,

If I don''t include <libgen.h> I get then warnig below in regcmp call:

warning: improper pointer/integer combination: op "="

but if I include it the warning is not shown, but them program compiles
fine.

What is the warning shown ?




好​​了,没有源代码,只能猜测。但是,我会

假设regcmp(它不是标准C的一部分)返回某种

指针,并且你将它分配给一个合适的指针

变量。我进一步假设非标准头文件libgen.h

提供了非标准regcmp函数的原型。


在C中,如果没有在使用范围时声明函数的范围

假设它返回一个int。当你直接将一个int分配给一个

指针时,编译器需要发出一个

诊断(在这种情况下是一个警告),这是在没有原型的情况下发生的libgen.h

可能提供。


所以包括标题(我假设libgen.h)的手册(或男人

页)为你的系统告诉你包括你正在使用的非标准的

函数。


当然,如果你有关于此的问题一个致力于你的

系统的小组然后回答的人会知道libgen.h是否是正确的

标题。在这里我们处理标准的C不扩展提供

具体实现。

-

Flash Gordon

生活在有趣的时间。

虽然我的电子邮件地址说垃圾邮件,但它是真实的,我读了它。



Well, without the source code one can only guess. However, I would
assume regcmp (which is not part of standard C) returns some kind of
pointer, and that you are assigning it to an appropriate pointer
variable. I further assume that the non-standard header libgen.h
provides a prototype for the non-standard regcmp function.

In C, if there is no declaration of a function in scope when it is used
it is assumed to return an int. The compiler is required to issue a
diagnostic (a warning in this case) when you assign an int directly to a
pointer, which is what is occurring without the prototype that libgen.h
probably provides.

So include the headers (I assume libgen.h) that the manuals (or man
pages) for your system tell you to include for the non-standard
functions you are using.

Of course, if you had asked about this on a group dedicated to your
system then the people answering would know if libgen.h was the correct
header to include. Here we deal with standard C not extensions provided
by specific implementations.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.


这篇关于regcmp警告:不正确的指针/整数组合:op&quot; =&quot;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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