通过该编译器选项,您可以控制编译器在未指定类型的情况下如何处理局部变量、参数和返回类型。
VO 和 Vulcan 方言的默认值为 -vo15+。Core 方言的默认值为 -vo15-
-vo15[+|-]
+ | - | 指定 + 或 -vo15,编译器会将未类型化的局部变量和返回类型视为 USUAL |
要在 Visual Studio 开发环境中设置该编译器选项,请执行以下操作
1.打开项目的 "属性"页面
2.点击 Dialect 选项卡
3.更改值
4.查看属性页
FUNCTION LongSquare(nLong as LONG) -/ 请注意,缺少返回类型
RETURN nLong * nLong
In VO/Vulcan mode this will (by default) generate a method with a USUAL return type. In Core mode this will not compile but produce a "Missing Type" error (XS1031)
When you compile with -vo15- this will also produce an error.
Similar code that will be influenced by this compiler option
FUNCTION MultiplyLong(nParam1 as LONG, nParam2) AS LONG -/ Note that the type for nParam2 is missing
RETURN nParam1 * nParam2
And
FUNCTION Tomorrow() AS Date
LOCAL dToday := Today() -/ Note that the AS DATE is missing
RETURN dToday + 1