Display Preferences
Warning messages (Delphi)
Go Up to Delphi Compiler Directives (List) Index

Type
Switch
Syntax
{$WARN identifier ON | OFF | ERROR | DEFAULT}
Default
All warnings are enabled
Scope
Local

Remarks
The $WARN directive gives you fine-grained control over individual warning messages.
Syntax  Effect
{$WARN identifier ON}  Allows the compiler to display the warning specified by the identifier
{$WARN identifier OFF}  The specified warning is not displayed
{$WARN identifier ERROR}  The specified warning is treated as error
{$WARN identifier DEFAULT}  Uses the default settings from the Project Options dialog box.
These warnings relate to symbols or units that use the hint directives, platform, deprecated, and library.
The identifier in the $WARN directive can have any of the following values:
BOUNDS_ERROR: Turns on or off warnings produced if a conversion is made that is no longer legal, owing to the lack of large unsigned types in Delphi versions prior to Delphi 4.
(See W1012 Constant expression violates subrange bounds.)
GARBAGE: Turns on or off warnings produced when the presence of non-whitespace text is detected past the end of the final 'end.' in the program, unit, library or package
(See W1011 Text after final 'END.' - ignored by compiler (Delphi).)
HIDDEN_VIRTUAL: Turns on or off warnings produced when a descendant declares a method of the same name as a method in an ancestor, and the ancestor method is virtual, but the descendant's method is not an override.
(See W1010 Method '%s' hides virtual method of base type '%s' (Delphi).)
HIDING_MEMBER: Turns on or off warnings produced when a descendant declares a new property of the same name as a property in an ancestor.
(See W1009 Redeclaration of '%s' hides a member in the base class (Delphi).)
HRESULT_COMPAT: Turns on or off warnings about using the type 'Integer' where 'HRESULT' is correct.
(See W1008 Integer and HRESULT interchanged.)
STRING_CONST_TRUNCED: Turns on or off all warnings about instances in which the compiler assigns a string literal or a constant value to a short string location that cannot hold the entire string.
(See W1014 String constant truncated to fit STRING%ld (Delphi).)
SYMBOL_DEPRECATED: Turns on or off all warnings about the deprecated directive on symbols in the current unit.
(See W1000 Symbol '%s' is deprecated (Delphi).)
SYMBOL_EXPERIMENTAL: Turns on or off all warnings about the experimental directive on symbols in the current unit.
(See W1003 Symbol '%s' is experimental (Delphi).)
SYMBOL_PLATFORM: Turns on or off all warnings about the platform directive on symbols in the current unit. (
See W1002 Symbol '%s' is specific to a platform (Delphi).)
SYMBOL_LIBRARY: Turns on or off all warnings about the library directive on symbols in the current unit.
(See W1001 Symbol '%s' is specific to a library (Delphi).)
UNIT_DEPRECATED: Turns on or off all warnings about the deprecated directive applied to a unit declaration.
(See W1006 Unit '%s' is deprecated (Delphi).)
UNIT_EXPERIMENTAL: Turns on or off all warnings about the experimental directive applied to a unit declaration.
(See W1007 Unit '%s' is experimental (Delphi).)
UNIT_LIBRARY: Turns on or off all warnings about the library directive in units where the library directive is specified.
(See W1004 Unit '%s' is specific to a library (Delphi).)
UNIT_PLATFORM: Turns on or off all warnings about the platform directive in units where the platform directive is specified.
(See W1005 Unit '%s' is specific to a platform (Delphi).)
ZERO_NIL_COMPAT: Turns on or off all warnings about instances in which the compiler converts 0 to a pointer with the value nil.
(See W1013 Constant 0 converted to NIL (Delphi).)

The only warnings that can be turned on/off using $WARN are the ones listed above.
The warnings set by the inline $WARN directive are carried for the compilation unit in which the directive appears, after which it reverts to the previous state. The warnings set by a $WARN directive take effect from that point on in the file.
The $WARNINGS directive also controls the generation of compiler warnings.

Examples
The following $WARN directive results in warnings about all references to experimental symbols in the current module:
{$WARNINGS ON}
{$WARN SYMBOL_EXPERIMENTAL ON}
 
procedure Foo; experimental;
begin
end;
 
begin
 Foo // Warning: W1003 Symbol 'Foo' is experimental
end.
If that $WARN directive were changed to:
{$WARN SYMBOL_EXPERIMENTAL ERROR}
then the compiler message would change to:
 Error: E1003 Symbol 'Foo' is experimental
and this module would not be compiled.

Another example:
 
{$WARN WIDECHAR_REDUCED OFF}
  if c in ['a', 'b'] then
    // ...
{$WARN WIDECHAR_REDUCED DEFAULT}
Possible warnings:
• ID_DEPRECATED,   //"x1000 Symbol '%s' is deprecated%s"
• ID_LIBRARY,    //"x1001 Symbol '%s' is specific to a library"
• ID_PLATFORM,    //"x1002 Symbol '%s' is specific to a platform"
• ID_EXPERIMENTAL,   //"x1003 Symbol '%s' is experimental"
• UNIT_LIBRARY,    //"x1004 Unit '%s' is specific to a library"
• UNIT_PLATFORM,   //"x1005 Unit '%s' is specific to a platform"
• UNIT_DEPRECATED,   //"x1006 Unit '%s' is deprecated"
• UNIT_EXPERIMENTAL,   //"x1007 Unit '%s' is experimental"
• HRESULT_COMPAT,   //"x1008 Integer and HRESULT interchanged"
• HIDING_MEMBER,   //"x1009 Redeclaration of '%s' hides a member in the base class"
• HIDDEN_VIRTUAL,   //"x1010 Method '%s' hides virtual method of base type '%s'"
• GARBAGE,    //"x1011 Text after final 'END.' - ignored by compiler"
• BOUNDS_ERROR,    //"x1012 Constant expression violates subrange bounds"
• ZERO_NIL_COMPAT,   //"x1013 Constant 0 converted to NIL"
• STRING_CONST_TRUNCED,   //"x1014 String constant truncated to fit STRING[%ld]"
• FOR_LOOP_VAR_VARPAR,   //"x1015 FOR-Loop variable '%s' cannot be passed as var parameter"
• TYPED_CONST_VARPAR,   //"x1016 Typed constant '%s' passed as var parameter"
• ASG_TO_TYPED_CONST,   //"x1017 Assignment to typed constant '%s'"
• CASE_LABEL_RANGE,   //"x1018 Case label outside of range of case expression"
• FOR_VARIABLE,    //"x1019 For loop control variable must be simple local variable"
• CONSTRUCTING_ABSTRACT,  //"x1020 Constructing instance of '%s' containing abstract method '%s.%s'"
• COMPARISON_FALSE,   //"x1021 Comparison always evaluates to False"
• COMPARISON_TRUE,   //"x1022 Comparison always evaluates to True"
• COMPARING_SIGNED_UNSIGNED,  //"x1023 Comparing signed and unsigned types - widened both operands"
• COMBINING_SIGNED_UNSIGNED,  //"x1024 Combining signed and unsigned types - widened both operands"
• UNSUPPORTED_CONSTRUCT,  //"x1025 Unsupported language feature: '%s'"
• FILE_OPEN,    //"x1026 File not found: '%s'"
• FILE_OPEN_UNITSRC,   //"F1027 Unit not found: '%s' or binary equivalents (%s)"
• BAD_GLOBAL_SYMBOL,   //"x1028 Bad global symbol definition: '%s' in object file '%s'"
• DUPLICATE_CTOR_DTOR,   //"x1029 Duplicate %s '%s' with identical parameters will be inacessible from C++"
• INVALID_DIRECTIVE,   //"x1030 Invalid compiler directive: '%s'"
• PACKAGE_NO_LINK,   //"x1031 Package '%s' will not be written to disk because -J option is enabled"
• PACKAGED_THREADVAR,   //"x1032 Exported package threadvar '%s.%s' cannot be used outside of this package"
• IMPLICIT_IMPORT,   //"x1033 Unit '%s' implicitly imported into package '%s'"
• HPPEMIT_IGNORED,   //"x1034 $HPPEMIT '%s' ignored"
• NO_RETVAL,    //"x1035 Return value of function '%s' might be undefined"
• USE_BEFORE_DEF,   //"x1036 Variable '%s' might not have been initialized"
• FOR_LOOP_VAR_UNDEF,   //"x1037 FOR-Loop variable '%s' may be undefined after loop"
• UNIT_NAME_MISMATCH,   //"E1038 Unit identifier '%s' does not match file name"
• NO_CFG_FILE_FOUND,   //"x1039 No configuration files found"
• IMPLICIT_VARIANTS,   //"x1040 Implicit use of Variants unit"
• UNICODE_TO_LOCALE,   //"x1041 Error converting Unicode char to locale charset. String truncated. Is your LANG environment variable set correctly?"
• LOCALE_TO_UNICODE,   //"x1042 Error converting locale string '%s' to Unicode. String truncated. Is your LANG environment variable set correctly?"
• IMAGEBASE_MULTIPLE,   //"x1043 Imagebase $%X is not a multiple of 64k.  Rounding down to $%X"
• SUSPICIOUS_TYPECAST,   //"x1044 Suspicious typecast of %s to %s"
• PRIVATE_PROPACCESSOR,   //"x1045 Property declaration references ancestor private '%s.%s'"
• UNSAFE_TYPE,     //"x1046 Unsafe type '%s%s%s'"
• UNSAFE_CODE,    //"x1047 Unsafe code '%s'"
• UNSAFE_CAST,    //"x1048 Unsafe typecast of '%s' to '%s'"
• OPTION_TRUNCATED,   //"x1049 value '%s' for option %s was truncated"
• WIDECHAR_REDUCED,   //"x1050 WideChar reduced to byte char in set expressions.  Consider using 'CharInSet' function in 'SysUtils' unit."
• DUPLICATES_IGNORED,   //"x1051 Duplicate symbol names in namespace.  Using '%s.%s' found in %s.  Ignoring duplicate in %s"
• UNIT_INIT_SEQ,   //"x1052 Can't find System.Runtime.CompilerServices.RunClassConstructor.  Unit initialization order will not follow uses clause order"
• LOCAL_PINVOKE,   //"x1053 Local PInvoke code has not been made because external routine '%s' in package '%s' is defined using package local types in its custom attributes" // (.Net only)
• MESSAGE_DIRECTIVE,   //"x1054 %s"
• TYPEINFO_IMPLICITLY_ADDED,  //"x1055 PUBLISHED caused RTTI ($M+) to be added to type '%s'"
• RLINK_WARNING,   //"x1056 %s%s%s"
• IMPLICIT_STRING_CAST,   //"x1057 Implicit string cast from '%s' to '%s'"
• IMPLICIT_STRING_CAST_LOSS,  //"x1058 Implicit string cast with potential data loss from '%s' to '%s'"
• EXPLICIT_STRING_CAST,   //"x1059 Explicit string cast from '%s' to '%s'"
• EXPLICIT_STRING_CAST_LOSS,  //"x1060 Explicit string cast with potential data loss from '%s' to '%s'"
• CVT_WCHAR_TO_ACHAR,   //"x1061 Narrowing given WideChar constant (#$%04X) to AnsiChar lost information"
• CVT_NARROWING_STRING_LOST,  //"x1062 Narrowing given wide string constant lost information"
• CVT_ACHAR_TO_WCHAR,   //"x1063 Widening given AnsiChar constant (#$%02X) to WideChar lost information"
• CVT_WIDENING_STRING_LOST,  //"x1064 Widening given AnsiString constant lost information"
• NON_PORTABLE_TYPECAST,  //"x1065 Typecast of %s to %s is non-portable; code may run differently on 32bit and 64bit platforms"
• LOST_EXT80_PRECISION,   //"x1066 Lost Extended floating point precision. Reduced to Double"
• LNKDFM_NOTFOUND,   //"x1067 Unable to load DLL %s"
• IMMUTABLE_STRINGS,   //"x1068 Modifying strings in place may not be supported in the future"
• MOBILE_DELPHI,   //"x1069 %s"
• UNSAFE_VOID_POINTER,   //"x1070 Use of untype pointer can disrupt instance reference counts"
 
• XML_WHITESPACE_NOT_ALLOWED,  //"x1201 XML comment on '%s' has badly formed XML -- 'Whitespace is not allowed at this location.'"
• XML_UNKNOWN_ENTITY,   //"x1202 XML comment on '%s' has badly formed XML -- 'Reference to undefined entity '%s'.'"
• XML_INVALID_NAME_START,  //"x1203 XML comment on '%s' has badly formed XML -- 'A name was started with an invalid character.'"
• XML_INVALID_NAME,   //"x1204 XML comment on '%s' has badly formed XML -- 'A name contained an invalid character.'"
• XML_EXPECTED_CHARACTER,  //"x1205 XML comment on '%s' has badly formed XML -- 'The character '%c' was expected.'"
• XML_CREF_NO_RESOLVE,   //"x1206 XML comment on '%s' has cref attribute '%s' that could not be resolved"
• XML_NO_PARM,    //"x1207 XML comment on '%s' has a param tag for '%s', but there is no parameter by that name"
• XML_NO_MATCHING_PARM,   //"x1208 Parameter '%s' has no matching param tag in the XML comment for '%s' (but other parameters do)"
See Also

Warnings (Delphi) ($WARNINGS)
Declarations and Statements
Directives, in Fundamental Syntactic Elements
Category: Delphi
Page Discussion View source History
Log in / create account
Search
 
RAD Studio XE4
XE4 Examples and Samples
XE4 Libraries
Main Page - XE4 Topics Wiki
What's New in XE4
Tutorials
FireMonkey Application Platform
Cross-Platform Applications
Getting Started
Steps in Developing a Project
Key Application Types
Win32 Developer's Guide
Modeling Tools
IDE Reference and Command-Line Utilities
Delphi Reference
C++ Reference
Subject Index
HTML5 Builder
Previous Versions
XE3 Topics
XE2 Topics
XE Topics
2010 Topics
In Other Languages
Deutsch
Français
日本語
Assistance
Known Problems and Recent Fixes
Random Page
Recent changes
Help
Toolbox
What links here
Related changes
Special pages
Printable version
Permanent link
This page was last modified on 26 February 2013, at 11:16. Privacy policy About RAD Studio Disclaimers Help Feedback

Delphi Waring 的信息的更多相关文章

  1. delphi弹出信息框大全(转载)

    1. 警告信息框 MessageBox(Handle,'警告信息框','警告信息框',MB_ICONWARNING); 2.疑问信息框 MessageBox(Handle,'疑问信息框','疑问信息框 ...

  2. Delphi 编译错误信息表

    ; not allowed before ELSE ElSE前不允许有“;” <clause> clause not allowed in OLE automation section 在 ...

  3. delphi弹出信息框大全

    1. 警告信息框 MessageBox(Handle,'警告信息框','警告信息框',MB_ICONWARNING);2.疑问信息框 MessageBox(Handle,'疑问信息框','疑问信息框' ...

  4. Delphi XE XML信息的读取

    <?xml version=""?> <ConString> <Item> <Name/> <Type>C</Ty ...

  5. delphi 如何关闭 Unsafe typecast of 和 Unsafe type 的waring

    有时在Delphi使用指针类型的数据,总是提示如下: [Warning] FGroupFeedBack.pas(796): Unsafe typecast of 'Pointer' to 'TObje ...

  6. Delphi的BPL介绍和使用 转

    了解BPL和DLL的关系将有助于我们更好地理解DELPHI在构件制作.运用和动态.静态编译的工作方式.对初学DELPHI但仍对DELPHI开发不甚清晰的朋友有一定帮助.BPL vs. DLL(原文ht ...

  7. 4种Delphi IDE的调试时查看内存的方法,太酷了!

    1.ctrl+alt+m,可以查看每个函数过程的内存位置 2.Ctrl+Alt+C 查看代码对应的汇编 3.原来用delphi看变量信息一直是简单的用watch看,但是有时候变量值直接用特定类型看总是 ...

  8. Delphi的自动编译软件Want

    Delphi自动编译环境的搭建及使用 什么是Want Want是一套Windows下用于编译Delphi源代码的工具.Want的名称是Windows Ant的意思. Ant是Java下最著名的自动编译 ...

  9. Elite Container DELPHI下的一个轻量级IoC对象容器

    一.简介: Elite Container是DELPHI下的一个轻量级IoC对象容器(IoC:Inverse of Control,反转控制).它是参考了Java中的Spring框架(主要是配置文件的 ...

随机推荐

  1. Unity3D 游戏开发应用篇——每日登陆(持久化类实现)

    上一篇中我们实现用本地文件实现了持久化类的保存,当然小型数据用PlayerPrefs存储,或者采用XML服务器持久化也行.因为我涉及的角色类和玩家类数据比较多,加上项目要求尽量少与服务器交互,所以采用 ...

  2. Unity3D开发之“获取IOS设备所在的国家代码"

    原地址:http://dong2008hong.blog.163.com/blog/static/469688272014021025578/ 在前一段时间游戏开发中需要实现获取IOS设备所在的国家代 ...

  3. nginx去掉单个目录和多个目录PHP执行权限方法

    我们经常希望某些目录不能执行php代码,如果是nginx的话,我们怎么设置Nginx对于某些目录禁止执行PHP权限呢.以前不知道,其实nginx去掉单个目录和多个目录PHP执行权限方法也很简单. 首先 ...

  4. leetcode Triangle及其思考

    Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent n ...

  5. hdu 1162 Eddy's picture(最小生成树,基础)

    题目 #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include<string.h> #include <ma ...

  6. 李洪强iOS开发支付集成之微信支付

    iOS开发支付集成之微信支付 微信支付也是需要签名的,也跟支付宝一样,可以在客户端签名,也可以在后台签名(当然,为了安全还是推荐在服务器上做签名,逻辑也比较好理解). 1 - 集成前首先要看看文档 开 ...

  7. 使用PowerDesigner进行数据库建模入门

    阅读目录 两种重要模型 创建表和主外键 创建视图和存储过程 生成数据库 PowerDesigner(简称PD)是一种强大的数据库建模工具,使用PD可以创建业务模型,UML类图等,当然最主要的功能是数据 ...

  8. 被称为同步神器的 BTSync,你可以怎么用?

    在这高速运作的信息化时代,使用云端来衔接工作和生活的点滴已是寻常事.可你是否曾扪心自问过:用各大云端备份自己的信息资料,真的安全放心吗? 毫不夸张的说,其实恶意代码和漏洞早已和你如影随形.你甚至都不用 ...

  9. 其实 Dropbox 的缺点也很明显,速度慢,空间小(我对国内的网盘的建议)

    作者:王成链接:http://www.zhihu.com/question/20237962/answer/15146386来源:知乎著作权归作者所有,转载请联系作者获得授权. 国内的云存储服务基本上 ...

  10. Android Handler传值方式

    前面介绍handler的时候,也用到过几种传值方式,今天来总结一下,并且重点说一下bundle方式,代码如下: package com.handlerThread; import android.ap ...