Include/Import question
BlitzMax Forums/BlitzMax Programming/Include/Import question
| ||
Hi all, Given I have a project consisting of two files like those below. - Is it sufficient to define "strict" in the main file so it will be enforced in functions.bmx too? - are the const's declared in main also visible in functions? I notice there's no Global Const statement. - Under what circumstances might include be better than import? I can't see any advantage, only longer compile time. The files (not actual code): main.bmx: Strict Include "functions.bmx" Const DEBUG = 1 Anyfunction() End functions.bmx: Function Anyfunction() ... End Function |
| ||
1. Yes 2. Consts are Global 3. Include is in there just for compatibility(?) |
| ||
- Under what circumstances might include be better than import? I can't see any advantage, only longer compile time. I guess if there is code executed in an include that you want to run at several places, you would not want to use Import. But then, you're better off having code like that in a function anyway, but I'm sure there could be a useful similar thing someone may want to do someday. Maybe. |
| ||
I wanted to have a massive list of constants to Include inside a type, but that causes an error. Bah. |
| ||
Since all constants are swapped out for their values at compile time, you may as well just shove the Const's in the main code. It makes no difference. Did I read somewhere that types' fields can have default values now? In which case you could do Field value=constantval and just never change it and you'll be fine =] |