1NAME 2 pragma 3 4DESCRIPTION 5 The preprocessor directive #pragma can be used to select 6 several compilation options. Multiple options can be selected 7 in one #pragma directive by separating them with commas. 8 9 combine_strings: Perform the addition of string literals at 10 compile time instead of run time, e.g. "foo"+"bar" 11 will be compiled as "foobar". Like the concatenation 12 of adjacent string literals ("foo" "bar" is compiled 13 as "foobar" as well) already done by the preprocessor, 14 the combine_strings will save memory, because the combined 15 strings can be shared between a blueprint and it's clones, 16 and the strings also have a good chance to be entered 17 into the global shared-string-table. 18 no_combine_string: Contrary to combine_strings, may be used to 19 deactivate a combine_strings pragma. 20 21 no_clone: The blueprint object can't be cloned. 22 no_inherit: The program can't be inherited. 23 no_shadow: The program can't be shadowed (similar to declaring 24 all functions as 'nomask'). 25 26 init_variables: Clone variables are initialized by __INIT(). 27 share_variables: Clone variables are initialized from the 28 blueprint. 29 30 weak_types: no type checking (this is the default). 31 strict_types: all functions must be declared with argument 32 prototypes, and the return values of call_other() must 33 be casted. 34 strong_types: all functions must be declared with complete 35 types of returnvalue and parameters. 36 save_types: the declaration data is kept after compilation and 37 checked at runtime. This is important for type-safe 38 inheritance. 39 40 verbose_errors: upon a compilation error, the driver displays 41 the actual context of the errorenous text. This is 42 helpful with errors within long expressions. 43 44 no_local_scopes, local_scopes: when local scoping is turned 45 off, local variables are visible even outside 46 their defining blocks. The setting of this pragma is 47 considered upon entry into a function only. By default, 48 local scoping is on. 49 local_scopes: local variables are visible only inside their 50 defining blocks. 51 52 pedantic: Certain warnings are treated as errors: 53 - failure to pass enough arguments to simul efuns 54 sloppy: Turns off pedantic (the default). 55 56 range_check: Use of questionable ranges (ranges of negative sizes, 57 or with bounds beyond the array's size) cause a runtime 58 warning. 59 no_range_check: Turns off range_check (the default). 60 61 warn_deprecated: Use of deprecated efuns or indexing operations 62 causes the compiler to issue a warning. 63 no_warn_deprecated: Turns off warn_deprecated (the default). 64 65 warn_empty_casts: A cast of a value to its own type generates 66 a warning (the default). Exception are casts to type 67 'mixed'. 68 no_warn_empty_casts: Turns off warn_empty_casts. 69 70 warn_missing_return: Warn if a value-returning function is missing 71 a return statement (the default). If possible, the driver 72 will try to detect this at compile time; otherwise a runtime 73 warning will be generated when the function is executed. 74 The check applies only to functions with a declared return 75 type other than 'void'. 76 no_warn_missing_return: Turn off warn_missing_return. 77 78 warn_function_inconsistent: If an inherited function is 79 overloaded with inconsistent return types or arguments, 80 a warning is generated; or if pragma_pedantic is in effect, 81 an error. By default this is active. 82 no_warn_function_inconsistent: An inherited function can 83 be overloaded with inconsistent return types or arguments, 84 as long as pragma_pedantic is not in effect. 85 86 This pragma is meant to easen the adaption of legacy 87 mudlib code - in general one should fix the warnings, 88 not turn them off. 89 90 When an object is compiled with type testing (#pragma 91 strict_types), all types are saved of the arguments for that 92 function during compilation. If the #pragma save_types is 93 specified, then the types are saved even after compilation, to 94 be used when the object is inherited. 95 96 The following two pragmas are available if the driver was 97 compiled with DEBUG and TRACE_CODE options: 98 99 set_code_window: Sets an offset to the current program writing 100 position. Use this BEFORE a piece of code where you 101 want to check to what bytecodes it is compiled. 102 show_code_window: shows some bytes starting at or near the 103 last point set_code_window was called. 104 105EXAMPLES 106 #pragma strict_types 107 #pragma no_clone, no_inherit 108 109HISTORY 110 LDMud 3.2.7 added local_scopes, no_local_scopes, no_clone 111 and no_inherit. 112 LDMud 3.2.8 added weak_types, pedantic and sloppy. 113 LDMud 3.2.9 allowed to specify multiple pragmas in one directive. 114 LDMud 3.2.9 added (no_)warn_deprecated. 115 LDMud 3.2.10 added (no_)warn_empty_casts. 116 Starting with LDMud 3.2.10, #pragma xxx_types in an included file are 117 no longer valid only until the end of the file, but remain active 118 when processing returns to the including file. 119 LDMud 3.2.11 added (no_)warn_function_inconsistent. 120 LDMud 3.3.378 added init_variables, share_variables. 121 LDMud 3.3.357 added (no_)warn_missing_return. 122 LDMud 3.3.646 added (no_)range_check. 123 124SEE ALSO 125 inheritance(LPC), initialisation(LPC), objects(C), 126 operators(LPC) 127