wonder Expert Licensed User Longtime User Feb 15, 2016 #1 If possible, I think it would be useful having the #define keyword added to the B4X preprocessor.
Erel B4X founder Staff member Licensed User Longtime User Feb 15, 2016 #2 What is the advantage of a preprocessor define over the standard const?
wonder Expert Licensed User Longtime User Feb 15, 2016 #3 - No memory consumption (indeed an INT is only 4 bytes, but still "a penny saved is a penny earned"...) - For constants, it's faster to write #define EULER 0.5772156649... than Dim EULER as Double = 0.5772156649... - For macros, it's faster to write #define OFFSCREEN (x < 0 OR y < 0 OR x > 100%x OR y > 100%y) than creating a method Code: Copy Sub OffScreen(x as double, y as double) As Boolean Return (x < 0 OR y < 0 OR x > 100%x OR y > 100%y) End Sub It's just a suggestion and only if it doesn't take a lot of effort to implement.
- No memory consumption (indeed an INT is only 4 bytes, but still "a penny saved is a penny earned"...) - For constants, it's faster to write #define EULER 0.5772156649... than Dim EULER as Double = 0.5772156649... - For macros, it's faster to write #define OFFSCREEN (x < 0 OR y < 0 OR x > 100%x OR y > 100%y) than creating a method Code: Copy Sub OffScreen(x as double, y as double) As Boolean Return (x < 0 OR y < 0 OR x > 100%x OR y > 100%y) End Sub It's just a suggestion and only if it doesn't take a lot of effort to implement.