* * *

Author Topic: define  (Read 603 times)

peter2005

  • Newbie
  • Posts: 3
define
« on: July 07, 2018, 12:15:54 pm »
I'm trying to convert some code from FPC to delphi and having trouble to understand this line.

Code: Pascal  [Select]
  1. {$define setoverflow:= status :=status or OVERFLOW}
  2.  

setoverflow is defined but those multiple assigments confuse me.

Is this conditional compilation or not?

taazz

  • Hero Member
  • *****
  • Posts: 5336
Re: define
« Reply #1 on: July 07, 2018, 12:31:41 pm »
I might be wrong but everything after overflow should be considered comments they have no real contribution to the final definition. Propably some kind of mnemonic on when or for what the setoverflow is used.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Thaddy

  • Hero Member
  • *****
  • Posts: 6731
Re: define
« Reply #2 on: July 07, 2018, 12:34:16 pm »
I'm trying to convert some code from FPC to delphi and having trouble to understand this line.

Code: Pascal  [Select]
  1. {$define setoverflow:= status :=status or OVERFLOW}
  2.  

setoverflow is defined but those multiple assigments confuse me.

Is this conditional compilation or not?

Delphi doesn't support macro's. You have to do it by hand.
Ada's daddy wrote this:"Fools are my theme, let satire be my song."

peter2005

  • Newbie
  • Posts: 3
Re: define
« Reply #3 on: July 07, 2018, 12:43:06 pm »
I might be wrong but everything after overflow should be considered comments they have no real contribution to the final definition. Propably some kind of mnemonic on when or for what the setoverflow is used.

so what's the purpose of the line? just to define  setoverflow ? and of what type?

Thaddy

  • Hero Member
  • *****
  • Posts: 6731
Re: define
« Reply #4 on: July 07, 2018, 12:45:56 pm »
It just means that when the compiler encounters "setoverflow" it will be replaced with "status :=status or OVERFLOW"
I suspect that OVERFLOW is also a macro...
« Last Edit: July 07, 2018, 12:54:52 pm by Thaddy »
Ada's daddy wrote this:"Fools are my theme, let satire be my song."

peter2005

  • Newbie
  • Posts: 3
Re: define
« Reply #5 on: July 07, 2018, 12:54:50 pm »
It just means that when the compiler encounters "setoverflow" it will be replaced with "status :=status or OVERFLOW"

thank you  :)

Thaddy

  • Hero Member
  • *****
  • Posts: 6731
Re: define
« Reply #6 on: July 07, 2018, 01:02:22 pm »
It just means that when the compiler encounters "setoverflow" it will be replaced with "status :=status or OVERFLOW"

thank you  :)
Note that converting to Delphi may give you more head-aches than converting Delphi to Lazarus.....
Ada's daddy wrote this:"Fools are my theme, let satire be my song."

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus