Eike Lange wrote:
By Compiling the following program with the given unit, the compiler throws no warning but fails running.
_p_MYSQL_OPT_CONNECT_TIMEOUT is defined as "const int" in a C file.
What do I have to do to make GPC throwing at least one warning like "accessing read only variable".
Fix (might not fit exactly since I've changed other things in this area):
--- p/module.c.orig Fri Apr 4 00:33:32 2003 +++ p/module.c Fri Apr 4 00:33:34 2003 @@ -3758,7 +3758,7 @@ dest = export_rename; else dest = src; - TREE_READONLY (t) = readonly; + TREE_READONLY (t) |= readonly; pushdecl_current_nocheck (t); if (current_module && current_module->main_program) IDENTIFIER_GLOBAL_VALUE (dest) = t;
BTW: Is mixing of attributes allowed like this: MySQLOptConnectTimeout: Integer; external; attribute (const, name ('_p_MYSQL_OPT_CONNECT_TIMEOUT'));
Yes. (BTW, I suggest `name = ...'. (I don't like too many (nested) paentheses. ;-)))
On Thu, Apr 03, 2003 at 09:45:01AM -0800, Russell Whitaker wrote:
On Thu, 3 Apr 2003, Eike Lange wrote: What if you changed:
var MySQLOptConnectTimeout: Integer;
to: function MySQLOptConnectTimeout: Integer;
I thought about it, yes.
I do not like this function stuff for constant values, because its too far away from what I'd like to say in my unit. I'd like to say "This is a constant value, please do not change".
It's also less efficient (might be sigificant in some situations, though probably not here).
Frank