Menu

MID$ Statement

spaglia
2016-09-08
2016-09-09
  • spaglia

    spaglia - 2016-09-08

    Hi Rob,

    Here is one of those quirks we chatted about. MID$ (statement) is non overlap-safe. I've included a small program that demonstrates this for you. I'm not sure duplicating this behavior is really important though:

    10 A$="Steve"
    20 MID$(A$,2)=A$
    30 PRINT "Should be SSSSS"
    40 PRINT A$

    Best,
    Steve

     
  • Rob Hagemans

    Rob Hagemans - 2016-09-09

    Hi Steve, thanks for the test program! That's indeed not yet handled 'correctly' by PC-BASIC, though the development branch is now in a position where it shouldn't be too painful to implement, as it is much more careful about string pointers and buffers throughout the code.

    I agree that it doesn't seem overly critical, but on the other hand I've found it really hard to distinguish important quirks from unimportant ones - even where GW-BASIC's behaviour is completely insane and looks like a bug in the original, there always seems to be someone's code depending on it...

    Have you come across Thomas McIntyre's BASIC language user essay and associated programs? (I mean these: https://web.archive.org/web/20060410121551/http://scottserver.net/basically/geewhiz.html) I've found them a real treasure trove of information about GW-BASIC's internal workings and many quirks.

    Rob

     
  • spaglia

    spaglia - 2016-09-09

    Thanks for the link!