Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
*NEW*
Current Version on STEAM:
16.026
Logfile:
EN
,
DE
Webchat:
Visit the chat
Home
Help
Search
Login
Register
GLBasic forum
»
Feature request
»
IDE/Syntax
»
Macros
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: Macros (Read 2337 times)
Quentin
Prof. Inline
Posts: 915
Macros
«
on:
2009-May-10 »
... could be a nice thing to make code easier to read. (especially for INLINE snippets)
Code: GLBasic
[Select]
MACRO newcommand
(
var
)
INLINE
var
++;
...
ENDINLINE
ENDMACRO
// use in GLBasic code
LOCAL
counter
%
newcommand
(
counter
)
Logged
Schranz0r
Premium User :)
Administrator
Prof. Inline
Posts: 5003
O Rly?
Re: Macros
«
Reply #1 on:
2009-May-10 »
FUNCTION can do the same...
EDIT:
Code: GLBasic
[Select]
LOCAL
my_var
=
10
Add
(
my_var
)
WHILE
TRUE
PRINT
my_var
,
10
,
10
SHOWSCREEN
WEND
END
FUNCTION
Add
:
BYREF
var
INLINE
var
++;
ENDINLINE
ENDFUNCTION
«
Last Edit: 2009-May-10 by Schranz0r
»
Logged
I
DGArray's
PC:
AMD RYzen 7 1700 @3.9Ghz, 16GB HyperX Fury 2666Mhz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard
Quentin
Prof. Inline
Posts: 915
Re: Macros
«
Reply #2 on:
2009-May-10 »
sure, but FUNCTION always does have overhead (calling, stack, ...)
Macro is a simple replacement of code, so produces bigger, but faster code.
Logged
Kitty Hello
code monkey
Administrator
Prof. Inline
Posts: 10675
here on my island the sea says 'hello'
Re: Macros
«
Reply #3 on:
2009-May-11 »
macros are not type safe. I would have to run a pre-pre-compiler for the macros. A nice idea, though.
Logged
FutureCow
HelpEditor
Prof. Inline
Posts: 680
Re: Macros
«
Reply #4 on:
2009-May-30 »
What about platform specific macros? That way you could do something like
if for iphone
resolution = 100x200
else
resolution = 800x600
endif
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
GLBasic forum
»
Feature request
»
IDE/Syntax
»
Macros