KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Multiple ways of hiding compiler warnings
PRODUCT: 4D | VERSION: 11.4 | PLATFORM: Mac & Win
Published On: June 4, 2009

The 4D compiler shows two types of messages: Errors and Warnings. Errors are serious and should addressed right away. Warning are not as serious and can sometimes be ignored (although not always).

From the compiler window, it is possible to hide all compiler warnings by toggling the button that resembles a yellow warning sign in the upper right hand corner of the compiler.



In addition to hiding all compiler warnings, it is also possible to selectively disable certain warnings during compilation. To do this, you just need to insert the following code into a 4D method:

`%W-warningnumber


The warning numbers are now specified at the end of each message in the list of compilation errors. For example, take a look at the following compiler window:



To selectively hide all compiler warnings for 518.7 (regarding the use of the "undefined" command") we can use the `%W-warningnumber directive in a 4D method as shown here:

  `%W-518.7
  `the above directive hides warnings for the "Undefined" command (warning 518.7)

Note: the second line was added for clarification; only the first line is needed to hide the warnings.

The next compilation will not display (nor count) any 518.7 warnings.

Commented by Timothy Penner on June 11, 2009 at 11:53 AM
In the example above error 518.7 (Using the function Undefined is not advised.) is ignored, but in this case ignoring this warning should actually be avoided because if the database has been compiled, the Undefined function returns False for all variables.
Commented by Thomas Fitch on June 8, 2009 at 10:14 AM
This tip can be very useful, but be careful with it. Most Warnings should not be avoided. Just because they do not stop compilation like errors does not mean that they cannot cause problems with your compiled database (or interpreted).