modeswitches

From Lazarus wiki
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Mode switches enable specific functionality and are enabled using the compiler directive {$modeswitch name}.

Free pascal supports the following mode switches.

 m_class,               { delphi class model }
 m_objpas,              { load objpas unit }
 m_result,              { result in functions }
 m_string_pchar,        { pchar 2 string conversion }
 m_cvar_support,        { cvar variable directive }
 m_nested_comment,      { nested comments }
 m_tp_procvar,          { tp style procvars (no @ needed) }
 m_mac_procvar,         { macpas style procvars }
 m_repeat_forward,      { repeating forward declarations is needed }
 m_pointer_2_procedure, { allows the assignement of pointers to
                          procedure variables                     }
 m_autoderef,           { does auto dereferencing of struct. vars }
 m_initfinal,           { initialization/finalization for units }
 m_default_ansistring,  { ansistring turned on by default }
 m_out,                 { support the calling convention OUT }
 m_default_para,        { support default parameters }
 m_hintdirective,       { support hint directives }
 m_duplicate_names,     { allow locals/paras to have duplicate names of globals }
 m_property,            { allow properties }
 m_default_inline,      { allow inline proc directive }
 m_except,              { allow exception-related keywords }
 m_objectivec1,         { support interfacing with Objective-C (1.0) }
 m_objectivec2,         { support interfacing with Objective-C (2.0) }
 m_nested_procvars,     { support nested procedural variables }
 m_non_local_goto,      { support non local gotos (like iso pascal) }
 m_advanced_records,    { advanced record syntax with visibility sections, methods and properties }
 m_isolike_unary_minus, { unary minus like in iso pascal: same precedence level as binary minus/plus }
 m_systemcodepage,      { use system codepage as compiler codepage by default, emit ansistrings with system codepage }
 m_final_fields,        { allows declaring fields as "final", which means they must be initialised
                          in the (class) constructor and are constant from then on (same as final
                          fields in Java) }
 m_default_unicodestring, { makes the default string type in $h+ mode unicodestring rather than
                            ansistring; similarly, char becomes unicodechar rather than ansichar }
 m_type_helpers,        { allows the declaration of "type helper" for all supported types
                          (primitive types, records, classes, interfaces) }
 m_blocks,              { support for http://en.wikipedia.org/wiki/Blocks_(C_language_extension) }
 m_isolike_io,          { I/O as it required by an ISO compatible compiler }
 m_isolike_program_para, { program parameters as it required by an ISO compatible compiler }
 m_isolike_mod,         { mod operation as it is required by an iso compatible compiler }
 m_array_operators,     { use Delphi compatible array operators instead of custom ones ("+") }
 m_multi_helpers        { helpers can appear in multiple scopes simultaneously }

See also