Re: Keypress Event problem




"Jamie" <jamie_ka1lpa_not_valid_after_ka1lpa_@xxxxxxxxxxx> wrote in message
news:MH0pl.24815$rb1.4314@xxxxxxxxxxxxxxx
Hans-Peter Diettrich wrote:

Jamie schrieb:

Writeable constants are a bad hack :-(

DoDi

Writeable constants are not a hack, it in fact are a know
support function of many if not most compilers in one why or
another..
It simply oads (predefined) values in the image that
can be accessed as normal data. You'll find that in many places
through out the libs.


You seem to confuse initialized variables with writeable constants.

DoDi
No, I'm not confused. I just have a good understanding of compilers and
the method I offered is the simplest to use with out using Event or
critical control objects for such a simple task.

If offers the coder to use the "Busy" name locally and maintain it's
define between calls on the stack in many code blocks with out conflict
and it makes it vary obvious to it's function when examining code.

If you are the kind that would rather have coders follow extreme
measures of coding that start to become unmanageable when a simple
solution is at hand, I feel sorry for you.

Just because it's not the way you do it or have been taught to do it
does not mean that no one else should do it.

I'll keep my practices to my self, I guess you don't like them and
most likely are going to make sure no one else does.

Have a good coding nightmare.

I found it very simple to use a global variable, although it might be
clearer to use what would be a static variable in the function. But that
does not seem to be an option in Delphi. It just seems like a constant
should be just that, meaning that it stays the same value and cannot be
changed. I am used to writing code for microprocessors and PICs, where a
constant would be in ROM, which physically cannot be changed (unless it is
flash memory or EEPROM). Variables should be just that, meaning they can be
changed and need to be changed at some point during execution.

The Delphi 4 help says that in older versions constants were writeable by
default, but recommends initialized variables for new projects. True
constants are defined as those that cannot change.

Thanks for the information, though. It's always good to learn something
new.

Paul


.



Relevant Pages

  • Re: Keypress Event problem
    ... Writeable constants are not a hack, it in fact are a know ... support function of many if not most compilers in one why or ...
    (comp.lang.pascal.delphi.misc)
  • Re: Keypress Event problem
    ... only way they're not an option in Delphi is if you deprive *yourself* ... The writeable constants option turns *all* typed constants into ...
    (comp.lang.pascal.delphi.misc)