Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
warning: [W180] Unreachable code problem?
#1
Hi  if i compile this, says

warning: [W180] Unreachable code

but i don't know why


the version is  zxbasic-1.15.2





Code:
' EXAMPE UNRECHABLE CODE

declare sub mySub()

Dim myNumber As uByte
cls

myBucle:
    for myNumber = 0 to 7          
        mySub()                  
    next myNumber
    goto myBucle

sub mySub()

end sub
Reply
#2
(09-10-2021, 06:17 PM)maeloterkim Wrote: Hi  if i compile this, says

warning: [W180] Unreachable code

but i don't know why


the version is  zxbasic-1.15.2





Code:
' EXAMPE UNRECHABLE CODE

declare sub mySub()

Dim myNumber As uByte
cls

myBucle:
    for myNumber = 0 to 7          
        mySub()                  
    next myNumber
    goto myBucle

sub mySub()

end sub

Looks like there is escape from the loop? 
and an empty mySub() ?

Thanks
Reply
#3
(09-12-2021, 09:10 PM)RandomiserUsr Wrote:
(09-10-2021, 06:17 PM)maeloterkim Wrote: Hi  if i compile this, says

warning: [W180] Unreachable code

but i don't know why


the version is  zxbasic-1.15.2





Code:
' EXAMPE UNRECHABLE CODE

declare sub mySub()

Dim myNumber As uByte
cls

myBucle:
    for myNumber = 0 to 7          
        mySub()                  
    next myNumber
    goto myBucle

sub mySub()

end sub

Looks like there is escape from the loop? 
and an empty mySub() ?

Thanks





if i fill the sub like this




sub mySub()




   dim a as ubyte


   dim b as ubyte



   a = 1


   b = 1


   a = a + b




end sub




the problem is the same I writed an empty sub only as a example I found the problem in first time with not empty sub



and where is the escape from the loop?  i don't see it

is a very very little structure.  Just one goto, one for and one sub
Reply
#4
(09-13-2021, 10:15 AM)maeloterkim Wrote:
(09-12-2021, 09:10 PM)RandomiserUsr Wrote:
(09-10-2021, 06:17 PM)maeloterkim Wrote: Hi  if i compile this, says

warning: [W180] Unreachable code

but i don't know why


the version is  zxbasic-1.15.2





Code:
' EXAMPE UNRECHABLE CODE

declare sub mySub()

Dim myNumber As uByte
cls

myBucle:
    for myNumber = 0 to 7          
        mySub()                  
    next myNumber
    goto myBucle

sub mySub()

end sub

Looks like there is escape from the loop? 
and an empty mySub() ?

Thanks





if i fill the sub like this




sub mySub()




   dim a as ubyte


   dim b as ubyte



   a = 1


   b = 1


   a = a + b




end sub




the problem is the same I writed an empty sub only as a example I found the problem in first time with not empty sub



and where is the escape from the loop?  i don't see it

is a very very little structure.  Just one goto, one for and one sub

Hi, sorry I missed off some of the message.

I can't see how this myBuckle loop would exit?

myBucle:
for myNumber = 0 to 7
mySub()
next myNumber
goto myBucle

Lastly what is the full code listing and full error you are getting?
Reply
#5
(09-10-2021, 06:17 PM)maeloterkim Wrote: Hi  if i compile this, says

warning: [W180] Unreachable code

but i don't know why


the version is  zxbasic-1.15.2





Code:
' EXAMPE UNRECHABLE CODE

declare sub mySub()

Dim myNumber As uByte
cls

myBucle:
    for myNumber = 0 to 7          
        mySub()                  
    next myNumber
    goto myBucle

sub mySub()

end sub

This is a bug. It's an spurious (wrong) warning.
I'll let you know when I fix it. Thanks for reporting!
Shy
Reply
#6
(09-10-2021, 06:17 PM)maeloterkim Wrote: Hi  if i compile this, says

warning: [W180] Unreachable code

but i don't know why


the version is  zxbasic-1.15.2





Code:
' EXAMPE UNRECHABLE CODE

declare sub mySub()

Dim myNumber As uByte
cls

myBucle:
    for myNumber = 0 to 7          
        mySub()                  
    next myNumber
    goto myBucle

sub mySub()

end sub

Ok, try this new beta version and tell me Shy  (download the one appropriate for you, which, I guess, will mostly be win32):

http://www.boriel.com/files/zxb/zxbasic-...a13.tar.gz
http://www.boriel.com/files/zxb/zxbasic-...beta13.zip
http://www.boriel.com/files/zxb/zxbasic-...-win32.zip
http://www.boriel.com/files/zxb/zxbasic-...x64.tar.gz
http://www.boriel.com/files/zxb/zxbasic-...cos.tar.gz
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)