int a,int b [a] [英] int a, int b[a]
问题描述
如果我理解正确,这应该不起作用:
int a;
int b [a];
我检查的SDK文件在3或4个结构中使用它。它确实说它用B风格写的
。如果这有所不同。
这是对的吗? < fstream.h>中的read()函数使用未签名的
char。但是< fstream>使用char?
Kev< di ************** @ pht.zzz>写在
新闻:Xn ********************** @ 216.168.3.44:
如果我理解正确,这应该不起作用:
int b [a];
我检查的SDK文件使用这个在3或4个结构中。它确实说它用C风格写成。如果这有所不同。
注意:看起来第一部分那些特定的结构(它在spec文件中
顺便说一句)更多他们应该包含哪些信息。与其说是如何使b $ b b使它们起作用。例如:找到a,然后使用new来创建b。
Kev schreef:
<中的read()函数fstream.h>使用unsigned char。
但是< fstream>使用char?
fstream.h不是标准头。它可以包含任何东西。通常
编译器包含它以提供对预标准程序的支持
(即1998年之前)。由于它是预先标准的,我们不能说任何事情
对它的内容是明智的。
HTH,>
Michiel Salters
Kev写道:
如果我理解正确,这应该不起作用:
int b [a];
AFAIK,这是一个内存分配错误等待发生。
我检查的SDK文件在3或4个结构中使用它。它确实说它用C风格写成。如果这有所不同。
结构本身可能会有一些更深层次的聪明,但是从
发布的代码看起来像是一个错误。 />
这是对的吗? < fstream.h>中的read()函数使用未签名的
字符。但是< fstream>使用char?
If I understand correctly, this should not work:
int a;
int b[a];
An SDK file I am checking out uses this in 3 or 4 structs. It does say its
written in C style. If that makes a difference.
Also is this right? The read() function in <fstream.h> uses an unsigned
char. But <fstream> uses char?
Kev <di**************@pht.zzz> wrote in
news:Xn**********************@216.168.3.44:
If I understand correctly, this should not work:
int a;
int b[a];
An SDK file I am checking out uses this in 3 or 4 structs. It does say
its written in C style. If that makes a difference.
Note: seems for the first part those particular structs (its in a spec file
btw) are more for what information they should contain. Not so much how to
make them work. Eg: finding a, then using new to create b.
Kev schreef:
The read() function in <fstream.h> uses an unsigned char.
But <fstream> uses char?
fstream.h is not a standard header. It can contain anything. Typically
it''s included by compilers to provide support for pre-standard programs
(i.e. before 1998). Since it''s pre-standard, we can''t say anything
sensible about what''s in it.
HTH,
Michiel Salters
Kev wrote:
If I understand correctly, this should not work:
int a;
int b[a];
AFAIK, that is a memory allocation fault waiting to happen.
An SDK file I am checking out uses this in 3 or 4 structs. It does say its
written in C style. If that makes a difference.
There may be some deeper cleverness in the structs themselves, but from
the code posted it looks like an error.
Also is this right? The read() function in <fstream.h> uses an unsigned
char. But <fstream> uses char?
这篇关于int a,int b [a]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!