pike.git
/
CHANGES
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/CHANGES:139:
o Fixed symbol resolution with deep inherits and mixins. o Added multi-character character constants. 'ILBM' is equivalent to (('I'<<24)|('L'<<16)|('B'<<8)|'M'). Unlike how it works in some C compilers the native byte order is never relevant.
-
o Added new syntax for literal-string
constats
+
o Added new syntax for literal-string
constants
#{, #( and #[ starts a literal string, and it is ended by the corresponding end marker: #}, #) and #] respectively. No character is modified at all inside the literal string, including newlines, \ " and '. So, the string #["\n\'##] will be equivalent to "\"\\n\\'#".
-
The main
usecase
is to write code in code:
+
The main
use-case
is to write code in code:
| string code = #[ | void main(int c, array v) { | string x = ""; | foreach( v[1..], string elm ) | x += reverse(elm)+","; | write("Testing: %s\n", reverse( x )); | #]; The three different start/end markers might be useful if you write code in code in code, since there is no way to quote the start/end markers. o Added a shorthand syntax for integer rages: xbit, where x is a number between 1 and 31. This can be used as an example to indicate that a string is 8 bits wide only: string(8bit) This is equivalent to the range (0..255) but can be easier to parse.
-
Similarily
int(1bit) is an alias for 'bool', and int(12bit) is
+
Similarly
int(1bit) is an alias for 'bool', and int(12bit) is
the same as int(0..4095).
-
o 'this::x' is
not
equivalent to 'this_program::x' -- access the
+
o 'this::x' is
now
equivalent to 'this_program::x' -- access the
identifier x in the current object. New preprocessor features ------------------------- o Support for the ", ##__VA_ARGS__" cpp feature. This makes the ‘##’ token paste operator have a special meaning when placed between a comma and a variable argument. If you write | #define err(format, ...) f(debug)werror("ERROR: "+format, ##__VA_ARGS__) and the variable argument is left out when the err macro is used, then the comma before the ‘##’ will be deleted. This does not happen if you pass an empty argument, nor does it happen if the token preceding ‘##’ is anything other than a comma. o The define __COUNTER__ has been added. It is a unique integer
-
value, the first time the macro is
expaded
it will be 1, the next time
+
value, the first time the macro is
expanded
it will be 1, the next time
2 etc. o The preprocessor can now be run with a cpp prefix feature. This is currently used by the precompiler to avoid two levels of preprocessing, one using "#cmod_" as the prefix and the other "#". o Dynamic macros
-
You can now add
programatic
macros. There is currently no syntax
+
You can now add
programmatic
macros. There is currently no syntax
that can be used to define these while compiling code, but you can add them from one program before compiling plug-ins/modules. The main use is macros like DEBUG(...) and IFDEBUG() that would expand to something if a debug setting is enabled in the module but nothing otherwise, or, to take an actual example from the Opera Mini source code: | add_predefine( "METRIC()", | lambda( string name, string ... code )