Announcement

Collapse
No announcement yet.

Compiling more efficiently

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Compiling more efficiently

    Don't know if this is a bug as much as just a request that the compiler work differently if possible.

    Right now unreferenced functions can sneak into program space if they happen to reference each other.

    Like this

    func one() two(); endfunc

    func two() endfunc

    func main() endfunc

    Hopefully you see what I mean. In this case two() would be compiled into my program space even though it is never used. Not sure if one() gets compiled as well but I would assume not. I'm starting to put lots of stuff into include files so it would be helpful if things like this didn't happen so that they don't take up program space when I don't use them even though they are included.

  • #2


    Bump... anybody? The OCD in me doesn't really want to 5 different copies of a function in 5 separate places when they could all be in one include file.

    Comment


    • #3


      Sorry, the compiler just checks for 'referenced' and hence includes things that are not used in the case you have demonstrated. It doesn't have a separate linker, so it can't be 'improved' to detect your case.

      Why not just have a second include, that isn't always included
      Mark

      Comment


      • #4


        Bumping this thread to request again

        I was just looking at the pre-processor directives and I found out that #IF USING solves my problem. Like this:

        HTML Code:
        #IF USING one
        func one() two(); endfunc
        #ENDIF
        
        #IF USING two
        func two() endfunc
        #ENDIF
        
        func main() endfunc
        Looks like it works because the one() function is truly ignored by the compiler as opposed to normal operation for the compiler where there is still some reference to that function.

        Is it possible to add this type of logic to the compiler? I would greatly appreciate it

        Comment


        • #5


          Scratch that. Looks like this only works in limited scenarios now that I really test it. I will carry on as before, feel free to ignore

          Comment


          • #6


            The example in the manual took a different form to the one you used, as in it appeared to be 'manual', rather than 'automatic' like yours seemed to be.
            Mark

            Comment

            Working...
            X