Gah - a solution with more questions. – EntropicLqd

Difference between revisions of "Compiler issues"

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
m (Parsing Issues)
(Parsing Issues)
 
Line 28: Line 28:
 
'''Switch''' ''Issues related to the [[switch]] block'' when attempting to access DefaultProperties from a static function.
 
'''Switch''' ''Issues related to the [[switch]] block'' when attempting to access DefaultProperties from a static function.
 
<br>
 
<br>
:Using the syntax Default.Identifier (to resolve a DefaultProperties reference from a static function) within a [[switch]] block confuses the compiler, which assumes the script has an error, and suggests 'default:', as in ''the default case'' for a switch statement.  The error message is ''Error, Missing ':' in 'Default''.
+
:Using the syntax Default.Identifier (to resolve a DefaultProperties reference from a static function) within a [[switch]] block confuses the compiler, which assumes the script has an error, and suggests 'default:', as in ''the default case'' for a switch statement.  The error message is ''Error, Missing ':' in 'Default''.  See examples for some workarounds.
  
 
{{CorrectWrong|<uscript>
 
{{CorrectWrong|<uscript>
Line 69: Line 69:
 
}
 
}
 
</uscript>}}
 
</uscript>}}
 +
 +
 +
'''DefaultProperties''' ''Issues related to the [[defaultproperties]] block'' and the mathematical syntax for representing negative numbers.  No warnings from the compiler.
 +
<br>
 +
:In mathematics, a negative number is sometimes represented in parenthesis, as in the expression 1 + (-1).  The parenthesis are not recognized, and thus the value becomes 0.0f (default-initialized).
 +
 +
{{CorrectWrong|<uscript>var float A;
 +
 +
DefaultProperties
 +
{
 +
  A = -1.0f
 +
}</uscript>|<uscript>var float A;
 +
 +
DefaultProperties
 +
{
 +
  A = (-1.0f) // A is 0.0f
 +
}</uscript>}}
 +
 +
 +
'''DefaultProperties''' ''Issues related to the [[defaultproperties]] block'' and const values.  No warnings from the compiler.
 +
<br>
 +
:A const value would appear default-initialized (0.0f, 0, false) when used in a [[defaultproperties]] block.
 +
 +
{{CorrectWrong|<uscript>var float A;
 +
 +
DefaultProperties
 +
{
 +
  A = 2.71828f
 +
}</uscript>|<uscript>var float A;
 +
const C = 2.71828f;
 +
 +
DefaultProperties
 +
{
 +
  A = C // A is 0.0f
 +
}</uscript>}}

Latest revision as of 21:02, 12 November 2011

Like any other compiler there are issues with the parsing therefor this page exists to mention those common issues and how to get around them.

Parsing Issues[edit]

Comment Issues related to the comments

Having an end of multi-line comment proceeded by a line comment on the same line.
Correct and Wrong example

DefaultProperties Issues related to the defaultproperties block

Placing a { on the same line of the defaultproperties declaration will cause the parser to skip the defaultproperties block thus :all of your default values will not be compiled, to get around this is easy just place the { on the next line!.
Correct and Wrong example

Switch Issues related to the switch block when attempting to access DefaultProperties from a static function.

Using the syntax Default.Identifier (to resolve a DefaultProperties reference from a static function) within a switch block confuses the compiler, which assumes the script has an error, and suggests 'default:', as in the default case for a switch statement. The error message is Error, Missing ':' in 'Default. See examples for some workarounds.
Correct and Wrong example


DefaultProperties Issues related to the defaultproperties block and the mathematical syntax for representing negative numbers. No warnings from the compiler.

In mathematics, a negative number is sometimes represented in parenthesis, as in the expression 1 + (-1). The parenthesis are not recognized, and thus the value becomes 0.0f (default-initialized).
Correct and Wrong example


DefaultProperties Issues related to the defaultproperties block and const values. No warnings from the compiler.

A const value would appear default-initialized (0.0f, 0, false) when used in a defaultproperties block.
Correct and Wrong example