Menu

Nested '#Define's

Help
2019-04-25
2019-04-27
  • Bertrand BAROTH

    Bertrand BAROTH - 2019-04-25

    Hello again ...

    Would this be OK :

    #Define Inp_clavier_mode Pind
    #Define Mode_beeper ((Inp_clavier_mode & 0xc0) = 0x40)
    .
    .
    If (Mode_beeper) Then
    ...

    It compiles without error ; but will it work the same way ?
    Thanks in advance ...

     

    Last edit: Bertrand BAROTH 2019-04-25
  • Hugh Considine

    Hugh Considine - 2019-04-25

    This will work, when the compiler replaces a constant with its value, it then searches the line for constants again and will make any more replacements needed. It will do this up to 100 times on a line, then it will stop replacing and show an error. (This to prevent something like "#define Const_A Const_B" and then "#define Const_B Const_A" from causing an infinite loop in the compiler.)

     
  • Bertrand BAROTH

    Bertrand BAROTH - 2019-04-25

    Thanks, this makes my source text easier to read ...

     
  • Anobium

    Anobium - 2019-04-27

    I will update the Help with these insights.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.