diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-06-14 18:24:43 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-06-14 18:24:43 +0000 |
commit | 68b29a08bc21b15b923b3430fbc41baedba73883 (patch) | |
tree | 23005644b6e4ec95914fd9e51c23735715f1ec5f /Game/Code/Classes/UCommon.pas | |
parent | bcec80f4bc1a7b299f37b49d463494d6817f4496 (diff) | |
download | usdx-68b29a08bc21b15b923b3430fbc41baedba73883.tar.gz usdx-68b29a08bc21b15b923b3430fbc41baedba73883.tar.xz usdx-68b29a08bc21b15b923b3430fbc41baedba73883.zip |
Removed some "const" parameter modifiers for external function declarations. Pascal has no equivalent to C's "pointer to constant type" const modifier. E.g. "const char* cstr" is not equivalent to "const cstr: PChar". This is because the first is a variable pointer to a constant type and the latter is a constant pointer to a variable type. This means contrary to the C version, in the incorrect pascal version the string can be changed. So it is like a false friend in this example, although "cstr: PChar" is not correct either, as the string can be changed too.
Also note that "var myvar: TMyType" is always passed as reference (a pointer is used for this, so it is equivalent to "myvar: PMyType"). This also normally applies to "const myvar: TMyType". But not if the type-size is < 4byte or the function is declared as stdcall or cdecl. In these cases the variable is passed on the stack and not as a pointer. So NEVER replace a C declaration "const my_type_t* my_var" with "const my_var: TMy_type" as it might fail. Use the var modifier instead.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1148 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions