Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #13187 > unrolled thread
| Started by | "georg...@gmail.com" <georgiev.hr@gmail.com> |
|---|---|
| First post | 2020-12-18 00:07 -0800 |
| Last post | 2021-01-04 00:38 -0800 |
| Articles | 10 — 4 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
Calling by reference - Cavo28SP4 "georg...@gmail.com" <georgiev.hr@gmail.com> - 2020-12-18 00:07 -0800
Re: Calling by reference - Cavo28SP4 "Wolfgang Riedmann" <wriedmann@gmail.com> - 2020-12-21 16:36 +0100
Re: Calling by reference - Cavo28SP4 "georg...@gmail.com" <georgiev.hr@gmail.com> - 2020-12-22 04:04 -0800
Re: Calling by reference - Cavo28SP4 Jamal <nospam@example.com> - 2020-12-22 16:24 -0500
Re: Calling by reference - Cavo28SP4 Jamal <nospam@example.com> - 2020-12-22 23:38 -0500
Re: Calling by reference - Cavo28SP4 "georg...@gmail.com" <georgiev.hr@gmail.com> - 2020-12-23 03:47 -0800
Re: Calling by reference - Cavo28SP4 Robert van der Hulst <rjvanderhulst@gmail.com> - 2020-12-23 05:00 -0800
Re: Calling by reference - Cavo28SP4 "georg...@gmail.com" <georgiev.hr@gmail.com> - 2020-12-23 06:05 -0800
Re: Calling by reference - Cavo28SP4 Jamal <nospam@example.com> - 2020-12-24 15:23 -0500
Re: Calling by reference - Cavo28SP4 "georg...@gmail.com" <georgiev.hr@gmail.com> - 2021-01-04 00:38 -0800
| From | "georg...@gmail.com" <georgiev.hr@gmail.com> |
|---|---|
| Date | 2020-12-18 00:07 -0800 |
| Subject | Calling by reference - Cavo28SP4 |
| Message-ID | <b68ebaac-b05d-4875-bce7-db953e846985n@googlegroups.com> |
Hello everyone, What is the best way to find the following problems with calling by reference in the software: function MyFunctioOne () as logic local nVar: = 0 as int MyFunctioTwo (@nVar) or MyFunctioTwo (nVar) return (true) function MyFunctioTwo (nVar ref real8) as logic .... nVar: = 1234.56 return (true) Thanks in advance for the reply! Best regards. Georgi Georgiev
[toc] | [next] | [standalone]
| From | "Wolfgang Riedmann" <wriedmann@gmail.com> |
|---|---|
| Date | 2020-12-21 16:36 +0100 |
| Message-ID | <i4btn3F12irU1@mid.individual.net> |
| In reply to | #13187 |
Hi Georgi, I'm not sure about this, but I think real8 has a something different behavior. If the code on both sides is yours, why you don't use the float datatype? Wolfgang georg...@gmail.com wrote: > Hello everyone, > > What is the best way to find the following problems with calling by > reference in the software: > > function MyFunctioOne () as logic > local nVar: = 0 as int > > MyFunctioTwo (@nVar) > or > MyFunctioTwo (nVar) > > return (true) > > function MyFunctioTwo (nVar ref real8) as logic > .... > nVar: = 1234.56 > > return (true) > > Thanks in advance for the reply! > > Best regards. > Georgi Georgiev --
[toc] | [prev] | [next] | [standalone]
| From | "georg...@gmail.com" <georgiev.hr@gmail.com> |
|---|---|
| Date | 2020-12-22 04:04 -0800 |
| Message-ID | <92c0ef90-7531-43d4-8608-188ad3991bd6n@googlegroups.com> |
| In reply to | #13190 |
Hello, Mr. Riedmann, Thanks for the reply. Maybe you didn't understand my question. I found bugs in the software and I want to check for others, but the features are many and manual checking would take a long time. I'm looking for incorrectly described with different types of variables to functions and those on which a reference call is incorrectly described. Regards, George
[toc] | [prev] | [next] | [standalone]
| From | Jamal <nospam@example.com> |
|---|---|
| Date | 2020-12-22 16:24 -0500 |
| Message-ID | <a06132ee-1804-37f8-3a77-3ddc92029819@example.com> |
| In reply to | #13187 |
When you don't pass the a variable by reference correctly, the compiler will give you a warning: Automatic Reference Generation: 51200. Just make sure Warnings is at least set to Low and Warnings as Errors is checked in the compiler options of the particular option. This will report all the issues at compile time and you will need to correct. Jamal On 12/18/2020 3:07 AM, georg...@gmail.com wrote: > Hello everyone, > > What is the best way to find the following problems with calling by reference in the software: > > function MyFunctioOne () as logic > local nVar: = 0 as int > > MyFunctioTwo (@nVar) > or > MyFunctioTwo (nVar) > > return (true) > > function MyFunctioTwo (nVar ref real8) as logic > .... > nVar: = 1234.56 > > return (true) > > Thanks in advance for the reply! > > Best regards. > Georgi Georgiev >
[toc] | [prev] | [next] | [standalone]
| From | Jamal <nospam@example.com> |
|---|---|
| Date | 2020-12-22 23:38 -0500 |
| Message-ID | <rruhjt$1pf1$1@gioia.aioe.org> |
| In reply to | #13194 |
Correction the "...the particular option" should say be "...the particular application" On 12/22/2020 4:24 PM, Jamal wrote: > When you don't pass the a variable by reference correctly, the compiler > will give you a warning: > > Automatic Reference Generation: 51200. > > Just make sure Warnings is at least set to Low and Warnings as Errors is > checked in the compiler options of the particular option. > This will report all the issues at compile time and you will need to > correct. > > Jamal > > On 12/18/2020 3:07 AM, georg...@gmail.com wrote: >> Hello everyone, >> >> What is the best way to find the following problems with calling by >> reference in the software: >> >> function MyFunctioOne () as logic >> local nVar: = 0 as int >> MyFunctioTwo (@nVar) >> or >> MyFunctioTwo (nVar) >> >> return (true) >> >> function MyFunctioTwo (nVar ref real8) as logic >> .... >> nVar: = 1234.56 >> >> return (true) >> >> Thanks in advance for the reply! >> >> Best regards. >> Georgi Georgiev >> >
[toc] | [prev] | [next] | [standalone]
| From | "georg...@gmail.com" <georgiev.hr@gmail.com> |
|---|---|
| Date | 2020-12-23 03:47 -0800 |
| Message-ID | <ca33bae1-6f3a-40cd-818d-c702ddc86240n@googlegroups.com> |
| In reply to | #13195 |
Thank you for the answer Jamal, Warnings are set on All and Warnings as Errors is checked on each application. However, I found an error with calling by reference. The compiler does not give an error if you have a variable of type int, for example, and call it by reference in a function in which it is described as real8. Any idea about that? Merry Christmas, George
[toc] | [prev] | [next] | [standalone]
| From | Robert van der Hulst <rjvanderhulst@gmail.com> |
|---|---|
| Date | 2020-12-23 05:00 -0800 |
| Message-ID | <cb6f8b52-41c1-4575-9a14-82e6979dbb52n@googlegroups.com> |
| In reply to | #13196 |
George, VO is very "forgiving" (sloppy) in this area. If a function expects a parameter by reference and you pass it a reference then it assumes that you know what you are doing and it does not complain. In your original example it will assume that the the nVar variable in the function points to a Real8 and will simply write the new value (8 bytes) at that location. Since you are passing an integer by reference this is more data then you expected, so this may corrupt the stack of the calling code. There is no way you can solve this in VO. And their will be no update to VO to fix this. The only way to solve this is by switching from VO to a new language, such as X#. X# will migrate that code from VO to .Net and the X# compiler WILL complain if you are mixing types. You do not have to run the code from X#, but you could use the migration to help diagnose your VO code and make the changes in VO. You can download X# at the site www.xsharp.info. Robert > Thank you for the answer Jamal, > > Warnings are set on All and Warnings as Errors is checked on each application. > However, I found an error with calling by reference. > > The compiler does not give an error if you have a variable of type int, for example, and call it by reference in a function in which it is described as real8. > Any idea about that? > > Merry Christmas, > > George
[toc] | [prev] | [next] | [standalone]
| From | "georg...@gmail.com" <georgiev.hr@gmail.com> |
|---|---|
| Date | 2020-12-23 06:05 -0800 |
| Message-ID | <4182303d-a0d3-49e4-bec3-b3b482e0bbd3n@googlegroups.com> |
| In reply to | #13197 |
Thank you for the answer Mr. Robert, As a result of the wrong type of variables, I got strange results in the software and that's why I started this topic. I installed X # a long time ago and continue to migrate the software. Thank you, I will take advantage of the good idea. George
[toc] | [prev] | [next] | [standalone]
| From | Jamal <nospam@example.com> |
|---|---|
| Date | 2020-12-24 15:23 -0500 |
| Message-ID | <f546b3ea-6026-b1c2-fdde-1f2d60405100@example.com> |
| In reply to | #13196 |
I see, just Robert said VO does not seem to check for the passed variable type. I never pass variables by reference; I think as you can see it's bug prone and you end with a corrupted return value. Jamal On 12/23/2020 6:47 AM, georg...@gmail.com wrote: > Thank you for the answer Jamal, > > Warnings are set on All and Warnings as Errors is checked on each application. > However, I found an error with calling by reference. > > The compiler does not give an error if you have a variable of type int, for example, and call it by reference in a function in which it is described as real8. > Any idea about that? > > Merry Christmas, > > George >
[toc] | [prev] | [next] | [standalone]
| From | "georg...@gmail.com" <georgiev.hr@gmail.com> |
|---|---|
| Date | 2021-01-04 00:38 -0800 |
| Message-ID | <a2a75c48-f632-4b26-929e-c0ac6a247f07n@googlegroups.com> |
| In reply to | #13199 |
Happy New Year 2021 ! Be healthy and have a lot of professional success! George
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web