procedure a1;
const bASC:Boolean=True;
begin
bASC:= not bASC;
end;
我用Delphi6的时候这段程序编译通过,为什么同样的程序到了Delphi7下面就不行了呢?
const bASC:Boolean=True;
begin
bASC:= not bASC;
end;
我用Delphi6的时候这段程序编译通过,为什么同样的程序到了Delphi7下面就不行了呢?
解决方案 »
- 【急,在线等】在delphi7中如何安装Ehlib4.1.4控件?
- 查询某个时间段(日期和时间分别用两个DateTimePicker表示)之间的记录的sql语句?
- form与form的问题
- 如何将一个string类型的第一个字符赋值给一个char类型?
- ^_^谁给我一份modelmaker的中文资料啊!^_^
- 如何调用DBLookupComboBox的onClick事件?
- 大家快来看呀!CSDN的天大的丑闻:118+1=118 哪个SB写的SQL语句!不会小学没毕业吧?
- 一个问答题!
- 在函數中怎樣傳第數組參數,及怎樣得到數組的上下限
- 高手们指点:怎样成为delphi高手,是否必须先成为VC高手!
- 高手救急,当我在程序最后执行了Application.Terminate 以后,程序报错,不知何故,时有时无,在线等待!(Terminate后程序做了哪些事呀?)
- 我用DelphiX For D7开发RPG游戏
procedure a1;
const bASC:Boolean=True;
begin
bASC:= not bASC;
end;
{$J-}
通过编译器开关J来显式指定常量为静态变量
在Project Properties对话框里,有个叫什么Assignable typed constant(好象是,类似的)的复选框,选上就行了.
procedure a1;
const bASC:Boolean=True;
begin
bASC:= not bASC;
end;
我用Delphi6的时候这段程序编译通过,为什么同样的程序到了Delphi7下面就不行了呢?
good,上面的朋说得有道理~~~~~~~~~~~~~`
Writeable typed constants//可写类型的常量TypeSwitch
Syntax{$J+} or {$J-}{$WRITEABLECONST ON} or {$WRITEABLECONST OFF}
Default{$J-}{$WRITEABLECONST OFF}
ScopeLocal
The $J directive controls whether typed constants can be modified or not. In the {$J+} state, typed constants can be modified, and are in essence initialized variables. In the {$J-} state, typed constants are truly constant, and any attempt to modify a typed constant causes the compiler to report an error.
Writeable consts refers to the use of a typed const as a variable modifiable at runtime. For example:const foo: Integer = 12;
begin
foo := 14;end.With $WRITEABLECONST OFF, this code produces a compile error on the assignment to the foo variable in the begin..end block. To fix it, change the const declaration to a var declaration.In previous versions of Delphi and Borland Pascal, typed constants were always writeable, corresponding to the {$J+} state. Old source code that uses writeable typed constants must be compiled in the {$J2B} state, but for new applications it is recommended that you use initialized variables and compile your code in the {$J-} state.———————————
┏━★━━◆━━★━┓
♂欢|◢CSDN◣|使♂
┃迎|◥论坛助手◤|用┃
┗━☆━━◇━━━☆┛
'D7也行的,主要是设置.
在Project Properties对话框里,有个叫什么Assignable typed constant(好象是,类似的)的复选框,选上就行了.'