Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Odd compile (lack of) error

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
njepsen

Bascom Member



Joined: 13 Aug 2007
Posts: 471

newzealand.gif
PostPosted: Thu Oct 10, 2019 5:51 am    Post subject: Odd compile (lack of) error Reply with quote

This typo, arrowed in the code below, compiled without an error, and the only thing that alerted me was that the vertical sub - end sub automatic indentation line, and the one between the If - endif did not get drawn

Code:

 sub  do_something()

     do          code
                  code

                  Select Case _min
                          Case 5 To 14
                             exit sub
                         Case 20 To 29
                            exit sub
                         Case 35 To 44
                           exit sub
                         Case Is > 49
                          exit sub
                  End Select

      Loop

                 if fileCount >0 then
                       tempstr = "sent "+ str(filecount) +" files from SD card"
                      call write_err_message(tempstr)
                 endif      '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<TYPO

End Sub
 


and this code ( with the correction to endif ) also compiled ok, but this time the indentation lies were all present and correct.



Code:

sub do_something()
      do
                  code
                  code

                  Select Case _min
                          Case 5 To 14
                             exit sub
                         Case 20 To 29
                            exit sub
                         Case 35 To 44
                           exit sub
                         Case Is > 49
                          exit sub
                  End Select

      Loop

                 if fileCount >0 then
                       tempstr = "sent "+ str(filecount) +" files from SD card"
                      call write_err_message(tempstr)
                 end if                                               '<<<<<<<<<<<<<<<<< TYPO FIXED

End Sub
 

(I'll now go & put my ear defenders on ) :D

(BASCOM-AVR version : 2.0.8.2 )

_________________
Neil
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 6197
Location: Holland

blank.gif
PostPosted: Thu Oct 10, 2019 8:40 am    Post subject: Reply with quote

maybe you think the forum rules do not apply for you?
when posting code, it must be complete, not some fragment that needs work.
when posting, it should be clear what it is you want. is this a question? or you want to share your project? or you reply to someone with help?
And more important, consider who can answer. is it a forum cry for help or should you write to mcs support?

in your case it seems like a question to get an error?
well it is actually there when you check the Code Explorer



Why not at compile time? Well it was there some versions ago but lot of users like to use endif instead of end if. So the compiler accepts it. Like always, you can not make everybody happy.
The IDE can reformat your code when you type endif it will change into End If.

_________________
Mark
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum