int / unsigned long * idiocy [英] int/unsigned long * idiocy

查看:101
本文介绍了int / unsigned long * idiocy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在某个未命名的头文件中有以下内容:


#define PIPE_WAIT 0x00000000

#define PIPE_NOWAIT 0x00000001


和编译器认为具有以下原型的函数:


__stdcall SetNamedPipeHandleState(void *,unsigned long *,

unsigned long *,unsigned long *); / *非标准调用约定* /


(未命名)编译器非常满意

SetNamedPipeHandleState(NULL,PIPE_WAIT,NULL,NULL) ;


但脾气暴躁


SetNamedPipeHandleState(NULL,PIPE_NOWAIT,NULL,NULL);


(两者都应根据某个未命名的网站有效)


当然,这里发生的事情是明确的(0x00000000是NULL,并且

因此与unsigned long *兼容,而0x00000001则不兼容)。这个

不是一个真正的问题,但只是一个幽默的看看有多少乐趣

处理这个未命名的设置可以。当然,评论是

欢迎。


-

Christopher Benson-Manica |我*应该*知道我在说什么 - 如果我

ataru(at)cyberspace.org |不,我需要知道。火焰欢迎。

I have, in a certain unnamed header file, the following:

#define PIPE_WAIT 0x00000000
#define PIPE_NOWAIT 0x00000001

and a function that the compiler believes has the following prototype:

__stdcall SetNamedPipeHandleState(void *,unsigned long *,
unsigned long *,unsigned long *); /* nonstandard calling convention */

The (unnamed) compiler is perfectly happy with

SetNamedPipeHandleState( NULL, PIPE_WAIT, NULL, NULL );

but has a temper tantrum over

SetNamedPipeHandleState( NULL, PIPE_NOWAIT, NULL, NULL );

(both of which should be valid according to a certain unnamed website)

Of course, what''s happening here is clear (0x00000000 is NULL, and
thus compatible with unsigned long *, while 0x00000001 is not). This
isn''t really a question, but just a humorous look at how much fun
dealing with this unnamed setup can be. Comments are, of course,
welcome.

--
Christopher Benson-Manica | I *should* know what I''m talking about - if I
ataru(at)cyberspace.org | don''t, I need to know. Flames welcome.

推荐答案

在< c2 ********** @ chessie.cirr.com> Christopher Benson-Manica< at *** @ nospam.cyberspace.org>写道:
In <c2**********@chessie.cirr.com> Christopher Benson-Manica <at***@nospam.cyberspace.org> writes:
我在某个未命名的头文件中有以下内容:

#define PIPE_WAIT 0x00000000
#define PIPE_NOWAIT 0x00000001

和编译器认为具有以下原型的函数:

__stdcall SetNamedPipeHandleState(void *,unsigned long *,
unsigned long *,unsigned long *); / *非标准调用约定* /

(未命名)编译器非常满意

SetNamedPipeHandleState(NULL,PIPE_WAIT,NULL,NULL);
但是脾气暴躁

SetNamedPipeHandleState(NULL,PIPE_NOWAIT,NULL,NULL);

(两者都应根据某个未命名的网站有效)

当然,这里发生的事情是清楚的(0x00000000是NULL,因此
与unsigned long *兼容,而0x00000001则不兼容)。这不是一个真正的问题,但只是幽默地看看处理这个未命名的设置有多么有趣。当然,评论是欢迎的。
I have, in a certain unnamed header file, the following:

#define PIPE_WAIT 0x00000000
#define PIPE_NOWAIT 0x00000001

and a function that the compiler believes has the following prototype:

__stdcall SetNamedPipeHandleState(void *,unsigned long *,
unsigned long *,unsigned long *); /* nonstandard calling convention */

The (unnamed) compiler is perfectly happy with

SetNamedPipeHandleState( NULL, PIPE_WAIT, NULL, NULL );

but has a temper tantrum over

SetNamedPipeHandleState( NULL, PIPE_NOWAIT, NULL, NULL );

(both of which should be valid according to a certain unnamed website)

Of course, what''s happening here is clear (0x00000000 is NULL, and
thus compatible with unsigned long *, while 0x00000001 is not). This
isn''t really a question, but just a humorous look at how much fun
dealing with this unnamed setup can be. Comments are, of course,
welcome.




显然,实现者从未试图查看PIPE_NOWAIT是否有效。

为什么当客户能够完成这项工作时,他应该打扰吗? ;-)


Dan

-

Dan Pop

DESY Zeuthen,RZ group

电子邮件: Da*****@ifh.de


Christopher Benson-Manica写道:
Christopher Benson-Manica wrote:
我在某个未命名的头文件中有以下内容:

#define PIPE_WAIT 0x00000000
#define PIPE_NOWAIT 0x00000001

和编译器认为具有以下原型的函数:

__stdcall SetNamedPipeHandleState(void *,unsigned long *,
unsigned long *,unsigned long *); / *非标准调用约定* /

(未命名)编译器非常满意

SetNamedPipeHandleState(NULL,PIPE_WAIT,NULL,NULL);
但是脾气暴躁

SetNamedPipeHandleState(NULL,PIPE_NOWAIT,NULL,NULL);

(两者都应根据某个未命名的网站有效)

当然,这里发生的事情是清楚的(0x00000000是NULL,因此
与unsigned long *兼容,而0x00000001则不兼容)。这不是一个真正的问题,但只是幽默地看看处理这个未命名的设置有多么有趣。当然,评论是欢迎的。
I have, in a certain unnamed header file, the following:

#define PIPE_WAIT 0x00000000
#define PIPE_NOWAIT 0x00000001

and a function that the compiler believes has the following prototype:

__stdcall SetNamedPipeHandleState(void *,unsigned long *,
unsigned long *,unsigned long *); /* nonstandard calling convention */

The (unnamed) compiler is perfectly happy with

SetNamedPipeHandleState( NULL, PIPE_WAIT, NULL, NULL );

but has a temper tantrum over

SetNamedPipeHandleState( NULL, PIPE_NOWAIT, NULL, NULL );

(both of which should be valid according to a certain unnamed website)

Of course, what''s happening here is clear (0x00000000 is NULL, and
thus compatible with unsigned long *, while 0x00000001 is not). This
isn''t really a question, but just a humorous look at how much fun
dealing with this unnamed setup can be. Comments are, of course,
welcome.




很明显你正在讨论哪个平台/设置。这是

同样清楚,你要么:

a)误读文件



b)阅读文档已过期或不正确。

http://msdn.microsoft.com/library/de...andlestate.asp


读取这似乎表明你需要一个可以包含定义的常量的局部无符号长(或者更好的是
,DWORD)。它没有明确提到,但很清楚预期的结果。符号

表示LPDWORD是指向双字的长指针。此外,即使

文档不清楚,所提供的示例在这个

问题上也很清楚。从文档中可以清楚地看出,您可以从两个表中按位或者使用
常量来实现读取和阻止

模式的组合。


这很常见,很多这样的系统调用都带有标志(对于

实例,open,creat,fcntl等)。即使文件是不正确的,也可以通过熟悉C和相关系统的人来合理地推断出这一点。


-nrk。


-

删除电子邮件的devnull



It is quite obvious which platform/setup you''re talking about. It is
equally clear that you''ve either:
a) Misread the documentation
or
b) Read documentation that is out of date or incorrect.

http://msdn.microsoft.com/library/de...andlestate.asp

Reading that seems to indicate that you need a local unsigned long (or
better yet, DWORD) that can contain the constants defined. It is not
explicitly mentioned, but it is quite clear what is expected. The notation
says LPDWORD is long pointer to double word. Further, even if the
documentation was unclear, the provided example is crystal clear on this
issue. It is also clear from the documentation that you would bitwise or
constants from the two tables to achieve combinations of read and blocking
modes.

This is quite normal with many such system calls that take flags (for
instance, open, creat, fcntl etc.). Even if the documentation was
incorrect, this much can be reasonably inferred by someone with more than a
passing familiarity with C and the system in question.

-nrk.

--
Remove devnull for email


Christopher Benson-Manica写道:
Christopher Benson-Manica wrote:

我在某个未命名的头文件中有以下内容:

#define PIPE_WAIT 0x00000000
#define PIPE_NOWAIT 0x00000001

和编译器认为具有以下原型的函数:

__stdcall SetNamedPipeHandleState(void *,unsigned long *,
unsigned long *,unsigned long *); / *非标准调用约定* /

(未命名)编译器非常满意

SetNamedPipeHandleState(NULL,PIPE_WAIT,NULL,NULL);
但是脾气暴躁

SetNamedPipeHandleState(NULL,PIPE_NOWAIT,NULL,NULL);

(两者都应该根据某个未命名的网站有效)

I have, in a certain unnamed header file, the following:

#define PIPE_WAIT 0x00000000
#define PIPE_NOWAIT 0x00000001

and a function that the compiler believes has the following prototype:

__stdcall SetNamedPipeHandleState(void *,unsigned long *,
unsigned long *,unsigned long *); /* nonstandard calling convention */

The (unnamed) compiler is perfectly happy with

SetNamedPipeHandleState( NULL, PIPE_WAIT, NULL, NULL );

but has a temper tantrum over

SetNamedPipeHandleState( NULL, PIPE_NOWAIT, NULL, NULL );

(both of which should be valid according to a certain unnamed website)




再次证明,这个名不见经传的公司有一个房间已经满满的b $ b b坐在电脑前的猴子。


Erik

-

+ --------------------------- -------------------------------- +

Erik de Castro Lopo 没有**** @ mega-nerd.com (是的,这是有效的)

+ --- -------------------------------------------------- ------ +

来自时代杂志,数字部分:



Proof yet again that said unamed company has a room full
of monkeys sitting in front of computers.

Erik
--
+-----------------------------------------------------------+
Erik de Castro Lopo no****@mega-nerd.com (Yes it''s valid)
+-----------------------------------------------------------+
From Time magazine, "Numbers" section:


这篇关于int / unsigned long * idiocy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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