View previous topic :: View next topic |
Author |
Message |
MichaelB.
Joined: 04 May 2017 Posts: 58
|
Posted: Wed Mar 30, 2022 5:19 pm Post subject: Yet another little Bug (nothing Fancy) |
|
|
Due my last night session i wrote something Strange , and realized it later. It makes no sense, but the Compiler have two different opinions.
Code: | $regfile = "m128def.dat"
$crystal = 7372800
$baud = 9600
$hwstack = 50
$swstack = 40
$framesize = 100
$sim
Dim B as Byte
Dim A(4) as Byte
A(1) = 255
Do
If A(1) = 255 then
Incr A(1) = 0 ' <--------- This is OK , Compiler passing it
End if
If B = 255 then
Incr B = 0 ' <--------- This is not OK, Compiler said "Invalid Datatype [0011]"
End if
Loop
End
|
(BASCOM-AVR version : 2.0.8.5 ) |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Wed Mar 30, 2022 7:39 pm Post subject: |
|
|
both are wrong. incr expects a variable. then it increases it, the additional data is ignored since it is not expected but not in all cases. will have a look at it. to be clear, in both cases you should get an error. _________________ Mark |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Thu Mar 31, 2022 9:42 am Post subject: |
|
|
Next step could be an AI-compiler, which rejects to compile code which is too messy.
Would depress some users |
|
Back to top |
|
|
MichaelB.
Joined: 04 May 2017 Posts: 58
|
Posted: Thu Mar 31, 2022 4:38 pm Post subject: |
|
|
I have more Bugs for you, which gives no Warnings .
1# STR didnt care if the target is a String or a Byte. Which is not supposed to do to work with Bytes as Traget.
Code: |
Dim A(4) As Byte ' no Datatype Warning
Dim C as Byte
C = 2
A(1) = STR ( C )
|
2# Further, when you work with JOIN and the mess above, following happend:
Code: |
Dim A(4) As Byte ' no Datatype Warning
Dim B as String * 4
Dim C as Byte
Dim D as Byte
C = 1
D = 2
A(1) = STR ( C )
A(2) = STR ( D )
B = Join ( A(1) , 4 ) ' results in 12121212
B = Join ( A(1) , 1 ) ' results in 12 , and is not supposed to do when the array is a BYTE and have to be a STRING Array.
|
|
|
Back to top |
|
|
laborratte
Joined: 27 Jul 2005 Posts: 299 Location: Berlin
|
Posted: Thu Mar 31, 2022 8:51 pm Post subject: |
|
|
@MWS: I think the compiler already has AI which drives users completely nuts when they do too stupid things... |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Fri Apr 01, 2022 8:51 am Post subject: |
|
|
MichaelB. wrote: | Which is not supposed to do to work with Bytes as Traget. |
You bet I can read words even if they would be posted in sub 100pt size.
And btw.:
Code: | Dim A(4) As Byte ' no Datatype Warning |
Sure there is no warning, as A(4) As Byte dimensions an array of bytes.
It's 'A' like Array, as you are at 'S' like STR, missed some letters?
As well it's not stated in the help, I feel it handy to have the result of STR in an byte-array without having to use OVERLAY.
Quote: | Further, when you work with JOIN and the mess above, following happend: |
It's like in real life, if you do not know what you do, strange things happen, LOL.
If you believe the compiler will catch any of your foolishnesses, because you code first and learn the proper syntax later, nope, you're definitely wrong.
And without trying to quench your motivation looking out for irregularities, bugs a.s.o., first try to learn proper usage of the language and then do your own code, you will see there will be more than enough bugs in your user-code.
Also I would suggest - if bug-hunting is of your taste - to look out for really serious stuff and not the Kindergarten-one only done by foolish users who look out for most creative combinations by ignoring the language's syntax. |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Fri Apr 01, 2022 8:58 am Post subject: |
|
|
laborratte wrote: | I think the compiler already has AI which drives users completely nuts when they do too stupid things... |
The AI is using 'laissez faire' a French-named teaching technology.
Clever users will recognize, learning by doing, that things do not work if done wrong.
The less clever ones sort themselves out. |
|
Back to top |
|
|
MichaelB.
Joined: 04 May 2017 Posts: 58
|
Posted: Fri Apr 01, 2022 9:21 am Post subject: |
|
|
MWS wrote: | You bet I can read words even if they would be posted in sub 100pt size. |
Yes
MWS wrote: | It's 'A' like Array, as you are at 'S' like STR, missed some letters? |
You can use as array too , little MWS.
MWS wrote: | As well it's not stated in the help, I feel it handy to have the result of STR in an byte-array without having to use OVERLAY. |
This is not the Purpose/task of the STR function.
If your angry Brain didnt get it so quick as you wish.... When you want the result of STR in a Byte Array the JOIN Function is not Working as it should be. Read my whole Bug report above again.
MWS wrote: | Also I would suggest - if bug-hunting is of your taste - to look out for really serious stuff and not the Kindergarten-one only done by foolish users who look out for most creative combinations by ignoring the language's syntax. |
Sure you might be a good Teacher, but it is unnecessary here in this Post.
I love Bug Hunting. Because its Hard. |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Fri Apr 01, 2022 10:11 am Post subject: |
|
|
few remarks :
- it is good to report these issues. it might help other users in the future making the same errors. it is better to send them to support since there it is guaranteed it is handled sooner or later. this forum does not have that guarantee.
- the code explorer will show you when you make a mistake. or not, in that case, report that too. _________________ Mark |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Fri Apr 01, 2022 10:12 am Post subject: |
|
|
MichaelB. wrote: | little MWS |
Oh, I see you don't know me.
Quote: | If your angry Brain didnt get it so quick as you wish. |
Quick enough for you, my conceited kid.
Quote: | I love Bug Hunting. Because its Hard. |
Look in the mirror and gotcha, you found one.
Again, your kindergarden stuff does not even relate to serious bug hunting. |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Fri Apr 01, 2022 10:22 am Post subject: |
|
|
I find the Russian War in Ukraine bad enough. Lets not start another war here.
I really dont have time for this. _________________ Mark |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Fri Apr 01, 2022 11:45 am Post subject: |
|
|
albertsm wrote: | Lets not start another war here. |
No intention, my reply was rather the nice kind. |
|
Back to top |
|
|
MichaelB.
Joined: 04 May 2017 Posts: 58
|
Posted: Sat Apr 02, 2022 11:18 am Post subject: |
|
|
Better you know what you say MWS, otherwise i have to call the Police for Online Mobbing.
Im just telling the Admin that the GUI or some Functions showing artefacts or aren't working as it should be.
Did't mean im bad in Programing. |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Sat Apr 02, 2022 8:52 pm Post subject: |
|
|
MichaelB. wrote: | Better you know what you say MWS, otherwise i have to call the Police for Online Mobbing. |
You certainly should do that, LOL. |
|
Back to top |
|
|
|