Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Bug Reports / misuse of inc command not detected

Author
Message
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 13th Apr 2013 13:52
This silly error didn't cause either a compile or run time error:



which of course should have been:

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 10th May 2013 06:50 Edited at: 10th May 2013 07:26
are you sure?


add: to express that rgb(x,x,x) are (seemingly?) constants which can't be (truly) inc'd, tho we are free to try.

it'll catch duplicating #constants but, maybe, it should catch any attempt to modify them?

add to it that we are free to represent color values in a variety of ways with the ink command, and it gets a little messy...

Virtual Nomad @ California, USA . DBPro V7.7 . Matrix1Utils 05.27.12
AMD Phenomâ„¢ X4 9750 Quad-Core @ 2.4 GHz . 8 GB PC2-6400 RAM
ATI Radeon HD 3650 @ 512 MB . Vista Home Premium 64 Bit
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 10th May 2013 16:44
Quote: "are you sure?"


Yes.

Your code simply shows one possible correct use of the inc command using a variable and isn't relevant to the issue.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 10th May 2013 17:14
i guess i didn't communicate the notion well enough. if dbpro considers rgb(255,255,0) a constant, why should incing it produce an error?

Virtual Nomad @ California, USA . DBPro V7.7 . Matrix1Utils 05.27.12
AMD Phenomâ„¢ X4 9750 Quad-Core @ 2.4 GHz . 8 GB PC2-6400 RAM
ATI Radeon HD 3650 @ 512 MB . Vista Home Premium 64 Bit
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 10th May 2013 22:55 Edited at: 10th May 2013 22:58
What do you mean? You can't increment it - or, if you can, how do you access the value?

[Aside: I'm not quite sure what you mean by "constant" in this connection. DBPro #constants are a different beast altogether and are nothing more than an instruction to the editor/compiler to replace every occurrence of any #constants by their defining string before doing further compilation. For example, the following snippet



is first changed to



before syntax checking etc. In other words #constants are simply a device to enable the programmer to use a useful nmemonic in place of a section of code. Nothing to do with constants in the sense of something that can't be changed as the following snippet demonstrates:



Of course you can use them to replace constant numeric values by a more meaningful verbal description - and those constants can't be changed of course. In fact the following snippet demonstrates this - and coincidentally should also give a compiler error (but doesn't). Is that what you are trying to say?



In other words this particular compiler obscurity affects #constants as well as function calls (and probably other things as well ).

I guess the storage location containing the result of the inc calculation, i.e. 34 in the above snippet, just can't be accessed via standard DBPro commands. The compiler should detect that situation in my opinion. The problem is quite clear if you look at the .dbm file produced by the compiler.]
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 18th May 2013 22:11
Much simpler demonstration of the issue:


While this doesn't make a lot of sense to do in an actual program, there's nothing syntactically wrong with it given how DBP seems to handle parameters. My guess it that DBP passes all parameters by reference, and memory is created for literals when they are used.

If checking for this was implemented, it would probably be a warning, which DBP doesn't really do. Warnings (unreachable code, loss of precision, etc) would be great, but that's more of a feature request than a bug.

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th May 2013 23:29
Nice example.

It is sometimes difficult to distinguish between a "feature" and a "bug". After all, we could request that DBPro has the feature that it is bug free.

Login to post a reply

Server time is: 2024-04-25 15:52:42
Your offset time is: 2024-04-25 15:52:42