- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
请帮助我进行回归测试,并确定以下代码在哪些 Delphi 版本中失败。
编辑: 我知道有一个编译器提示;事实上,在我继承的一个项目中发现它以某种方式关闭了编译器提示(我看到很多人这样做,因为他们认为编译器提示总是无害的,这个案例表明它不是)。
出于文档目的,我仍然想知道在哪些 Delphi 版本中存在此编译器异常。
[DCC Hint] QC90921_SO4717399TestCase.pas(47): H2135 FOR or WHILE loop executes zero times - deleted
在 Delphi XE、2009、2007 和 5 中,它失败并显示以下输出。
我还没有时间研究其他 Delphi 版本。
请帮助我解决这个问题,并回答它在哪些其他 Delphi 版本上也失败了。
Low/High const fail: 0
Low/High hex literal fail: 0
Low/High decimal literal fail: 0
这段代码也是 QC 90921 的一部分。 :
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
CardinalIndex: Cardinal;
CardinalFirst: Cardinal;
CardinalLast: Cardinal;
Count: Int64;
Target: Int64;
begin
try
Target := High(Cardinal);
Inc(Target);
Count := 0;
for CardinalIndex := Low(CardinalIndex) to High(CardinalIndex) do
Inc(Count);
if Target <> Count then
Writeln('Low/High const fail: ', Count);
Count := 0;
for CardinalIndex := 0 to $FFFFFFFF do
Inc(Count);
if Target <> Count then
Writeln('Low/High hex literal fail: ', Count);
Count := 0;
for CardinalIndex := 0 to 4294967295 do
Inc(Count);
if Target <> Count then
Writeln('Low/High decimal literal fail: ', Count);
Count := 0;
CardinalFirst := Low(Cardinal);
CardinalLast := High(Cardinal);
for CardinalIndex := CardinalFirst to CardinalLast do
Inc(Count);
if Target <> Count then
Writeln('Low/High variable fail: ', Count);
Count := 0;
CardinalFirst := 0;
CardinalLast := $FFFFFFFF;
for CardinalIndex := CardinalFirst to CardinalLast do
Inc(Count);
if Target <> Count then
Writeln('hex literal Variable fail: ', Count);
Count := 0;
CardinalFirst := 0;
CardinalLast := 4294967295;
for CardinalIndex := CardinalFirst to CardinalLast do
Inc(Count);
if Target <> Count then
Writeln('decimal literal Variable fail: ', Count);
Write('Press <Enter>');
Readln;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.
编辑: 答案摘要;它在这些 Delphi 版本中失败:
--杰伦
最佳答案
我想,因为这是一个记录在案的缺陷,所有 High(Cardinal)
> High(Longint)
(Delphi 4 及更高版本)的版本都会表现出这种行为。
来自“H2135: FOR or WHILE loop executes zero times - deleted (Delphi)”:
You may see this warning if a FOR loop increments its control variable from a value within the range of Longint to a value outside the range of Longint. For example:
This results from a limitation in the compiler which you can work around by replacing the FOR loop with a WHILE loop.var I: Cardinal;
begin
For I := 0 to $FFFFFFFF do
...
关于delphi - 在其他哪些 Delphi 版本中,Cardinals 的 for 循环失败了?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4717399/
有人知道我该如何解决这个问题? CREATE OR REPLACE FUNCTION PRDLIB.COUNTER( sROWS INT) RETURNS TABLE ( ROW_ID INT) LA
我不太明白这个“不兼容的类型”错误(Delphi XE2) function TWaveBase.GetHandle: THandle; begin if HandleNeeded then be
我必须将 Cardinal 打包和解包为四个单字节字段(在 Delphi 2010 中)。 我正在对大图像的所有像素执行此操作,因此我需要速度快! 谁能告诉我如何编写这两个函数? (const 和 o
我这里有一个程序,它在 Delphi 3 中运行良好,我在 Turbo Delphi 2006 上编译并测试了它,发现了一个问题。问题是这样的:我使用“基数”数据类型作为某些内容的索引。它在 Delp
我正在尝试根据从 DataFrame 获取的数据训练 LSTM 网络。 这是代码: x_lstm=x.to_numpy().reshape(1,x.shape[0],x.shape[1]) model
我现在正在致力于将 Visual Basic 代码采用到 Delphi 代码中。 我有: // prepare query with oleClipboardFormat do be
如何读取和/或指定实体-关系-模型(Chen-Notation)的三元关系中的基数(最小/最大)? 例如:一位负责人与他的相关员工一起参观了多项资质。现在,我想知道如何在 Min-Max-Notati
本文整理了Java中com.ohmdb.filestore.ZonesImpl.cardinality()方法的一些代码示例,展示了ZonesImpl.cardinality()的具体用法。这些代码示
我目前正在学习计算机工程,我记得一个叫做信息系统导论类(class)的教授说,两个以 1:1 基数相关的类(class)是没有意义的。 例如:我有 Client类和 Telephone类(class)
我正在尝试创建一个具有多个输入分支的 keras 模型,但 keras 不喜欢输入具有不同的大小。 这是一个最小的例子: import numpy as np from tensorflow impo
我正在使用 d3 开发一个新项目,创建一个显示从 0 到 10 的分数的图表。数据如下所示: var data = [ {axis: 'People', value: getRandomSco
我的 df 看起来像这样,其中“O”是一年中的序数日期。 Close O Date 1950-01-03 16.66 3 1950-01-04 16.
您能否描述一下:术语“基数”与数据建模中的“关系”有何不同? 最佳答案 它们是完全不同的概念(有点像问算术中“加法”和“零”有什么区别),因此除了简单地建议查找它们的定义外,很难解释任何“差异”。 关
请帮助我进行回归测试,并确定以下代码在哪些 Delphi 版本中失败。 编辑: 我知道有一个编译器提示;事实上,在我继承的一个项目中发现它以某种方式关闭了编译器提示(我看到很多人这样做,因为他们认为编
program UInt32ToVariant; uses Vcl.Dialogs, System.SysUtils, System.Variants; var ui32Val: Cardin
我正在尝试在我的应用程序中实现 Songbird.js 文件。我可以看到 cardinal.continue 方法不会单独在 IE11 中触发。我收到以下错误。 我在框架级别本身收到以下错误。 SCR
Common Lisp 提供了可爱的 ~r 指令来打印基数英文数字。例如: (format nil "~r" 27) -> "twenty-seven" lisp 是否提供相反的指令(或某些库函数),
我在我的数据库中创建了一个外键关系,这样我就可以在这种情况下将另一个表作为属性访问 House.Area 现在,如果我创建一个 House 对象并将 Area 设为 null,我会在 SubmitCh
我有一个学院的数据库。它的结构有三个表:- 第一个是学科硕士。该表可能有 20 多行。 CREATE TABLE `SUBJECTS` ( `ID_SB` tinyint(4) NOT NULL
在Delphi中,LongInt和Integer、LongWord和Cardinal有什么区别? 有时我会发现DWORD的用法,它是什么? 它们在所有版本的 Delphi 中都是一致的吗?我应该坚持哪
我是一名优秀的程序员,十分优秀!