On Fri, Jul 3, 2009 at 12:48 AM, cdb wrote: > I made this OT as it isn't reaaly Pic'ish anymore. > > :: As you can see the variables declared with 'const' are really > :: static (like > :: the 'static' directive in C) > > :: const > :: globConst: Integer = 999; > :: > :: > :: procedure test ( par: Integer ); > :: const > :: v1: Integer = 0; { it's a static variable } > > Surely that goes against what a const is, in that a constant is a > contract between the coder and the compiler that that value will NEVER > alter? As far as I know the original meaning of 'const' in Pascal was more like a #define in C or even more like an EQU in asm. so const v1 = 5345; still works, and compiler would give you a big error if you try to assign a value to it later on. Also if you try to bind a variable on top of it (like in test3) then you will get a funny runtime error when you try access to it either read or write -- no compile time error though on FreePascal at least. However, if you give a type to that then the whole lot becomes a variable with the difference that you have to initialize it and that the variable becomes static (in case it was declared in your procedure). This is same ugly as the 'static' directive in C when used it for either declaring static variables or module scope global functions/variables -- depending on where you use that. Tamas > > > I'm off to rediscover my Pascal tutorial books, see what they say. > > Colin > -- > cdb, colin@btech-online.co.uk on 3/07/2009 > > Web presence: www.btech-online.co.uk > > Hosted by: www.1and1.co.uk/?k_id=7988359 > > > > > > > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.mcuhobby.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist