Amiga-Development

Please login or register.

Login with username, password and session length
Advanced search  

News:

Created for developers of all Amiga camps

Pages: 1 [2]

Author Topic: Can VBCC make Pure Residentable code easily?  (Read 6942 times)

0 Members and 1 Guest are viewing this topic.

itix

  • Newbie
  • *
  • Posts: 42
    • View Profile
Re: Can VBCC make Pure Residentable code easily?
« Reply #15 on: July 23, 2013, 09:05:08 AM »

Do not use VBCC startup code if you dont know if it is pure (re-entrant) or not. It will be executed on each iteration your resident program is called and if VBCC startup code is not designed to be re-entrant it will not work correctly. I am too lazy to check VBCC documentation online so go find it out yourself ;)

Anyway, compilers dont have to include built-in support for residentable programs even if it is often very nice. To write pure, residentable re-entrant code you can write your own startup code. It doesnt require much. Just avoid using globals and when you are using writable globals (like library bases) you must be very careful to NOT clear your variables on exit or close libraries you didnt open in the first place. It can be done. Just make yourself aware there might be concurrent access to your variables.

Autovariables are of course safe.
Logged

Team Chaos Leader

  • Administrator
  • Sr. Member
  • *****
  • Posts: 484
  • JC + Asm Coder
    • View Profile
Re: Can VBCC make Pure Residentable code easily?
« Reply #16 on: July 23, 2013, 10:00:22 AM »

Autovariables are of course safe.
Yes I love stack-based variables.  They are groovy!  And they always clean up after themselves.  :)
Logged

Veda

  • Hero Member
  • *****
  • Gender: Male
  • Posts: 1008
  • Sleep is overrated
    • View Profile
Re: Can VBCC make Pure Residentable code easily?
« Reply #17 on: July 25, 2013, 02:28:13 AM »

reentrant code try to imaging a interrupt occuring in the middle of your code. ;)
Logged
Pages: 1 [2]