Forums › Forums › SIMPOL Programming › Best Practices when modifying supplied .sml
- This topic has 15 replies, 2 voices, and was last updated 11 years, 10 months ago by Michael.
- AuthorPosts
- July 4, 2012 at 6:09 pm #1966MichaelKeymaster
On 25/06/2012 19:30, John D Kromkowski wrote:
> On 6/25/2012 6:24 AM, Neil Robinson wrote:
>> On 23/06/2012 01:51, John D Kromkowski wrote:
>>> include "tbcombos.sma" include "toolbar.sma" include "errors.sma"
>>>
>>> When I switched the order of the includes to put errors.sma first, problem went a way. Is this a bug or just something I
>>> should have know about?
>> Not a bug, but something you need to be aware of. The compiler is a single pass complier, so it processes the include files
>> in the order it hits them. That is why constants used throughout the project need to be at the front of the include list.
>>
>> Ciao, Neil
> Ok. Is this in the documentation that I missed? On related note:I am not sure about this one, to be fair.
> Could (Should) the
>
> include "uisyshelphdr.sma"
>
> statement which is part of tcombos.sma, just be put in the primary.sma?Yes, if you are using the items that are defined in uisyshelphdr.sma in other places in the code (which will be the case for a
more complex application), then just move it to the top of the main program file.> And if you link to the uisyshelp.sml (under "settings"), why do you even need to include uisyshelpdr.sma
The uisyshelphdr.sma includes constant definitions so that you can use the constant names in your code rather than hard-coding
values. This protects your code from future updates (if the value of the constant changed it wouldn't matter if you are using the
name instead of the value). It also makes your code easier to read. That is the whole point of most of the include files, they
contain constant definitions, not code.Ciao, Neil
- AuthorPosts
- You must be logged in to reply to this topic.