Page 1 of 1
Harbour warning
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Sat Mar 30, 2013 5:38 pm
by Enrico Maria Giordano
Dear friends, how do you compile the following sample using Harbour?
- Code: Select all Expand view
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg
DEFINE DIALOG oDlg
ACTIVATE DIALOG oDlg;
ON INIT MSGINFO( "Hello" );
CENTER
RETURN NIL
I get:
- Code: Select all Expand view
test.prg(12) Warning W0004 Codeblock parameter 'SELF' declared but not used
in function 'MAIN'
and I cannot found a way to disable that warning (with xHarbour you can use /wb-).
EMG
Re: Harbour warning
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Sat Mar 30, 2013 6:23 pm
by James Bott
Enrico,
In Windows.ch you will see:
<oWnd>:bInit [ := \{ | Self | <uInit> \} ],;
But in Dialog.ch INIT is processed like this:
[ ! <.NonModal.> ], [{|Self|<uInit>}],;
I understand that dialogs can be nonmodal and windows can't so there has to be a difference, but perhaps there is a syntax error in the preprosser code.
I have never tried a dialog with an INIT clause, and I don't use Harbour so I can't test it.
Have you tried instead:
oDlg:bInit:= {|| MSGINFO( "Hello" )}
Or:
oDlg:bInit:= { | oDlg | msgInfo("Hello")}
Regards,
James
Re: Harbour warning
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Sat Mar 30, 2013 7:20 pm
by Enrico Maria Giordano
James, this is only a sample. There are tons of other similar warnings when I compile my code using Harbour. The problem would be solved in my code if I used Self in the ON INIT clause but I don't always need Self and I don't want to be forced to use all the codeblock parameters.
EMG
Re: Harbour warning
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Sat Mar 30, 2013 8:06 pm
by ADutheil
I got rid of theses warnings by using bInit codeblock
- Code: Select all Expand view
DEFINE DIALOG oDlg
oDlg:binit := { || whatever_you_need }
ACTIVATE DIALOG oDlg
Re: Harbour warning
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Sat Mar 30, 2013 10:05 pm
by James Bott
Enrico Maria Giordano wrote:The problem would be solved in my code if I used Self in the ON INIT clause but I don't always need Self and I don't want to be forced to use all the codeblock parameters.
EMG
Then, I would suggest trying to find a fix by modifying the dialog.ch file using the windows.ch file as a reference.
James
Re: Harbour warning
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Sat Mar 30, 2013 10:56 pm
by Antonio Linares
Enrico,
I have asked it in the Harbour devel list, so lets wait for an answer
https://groups.google.com/forum/?fromgroups=#!topic/harbour-devel/_07abkqyoa8
Re: Harbour warning
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Sat Mar 30, 2013 11:49 pm
by Enrico Maria Giordano
Thank you, Master!
![Smile :-)](./images/smilies/icon_smile.gif)
EMG
Re: Harbour warning
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Sun Mar 31, 2013 4:49 am
by Antonio Linares
Enrico,
See what Viktor says:
"No, the closest is -w2."
Re: Harbour warning
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Sun Mar 31, 2013 5:50 am
by nageswaragunupudi
In both Harbour and xHarbour setting warning level to 2 ( -w2 ) generates warnings for variables declared but not used.
Again both in Harbour and xHarbour setting warning level to 1 ( -w1 ) does not generate these warnings.
So, normally I use -w1 and use -w2 occasionally for the purpose of removing unwanted declarations in the code.
I find both Harbour and xHarbour behaving the same way. Am I missing something?
Re: Harbour warning
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Sun Mar 31, 2013 10:24 am
by Enrico Maria Giordano
Antonio Linares wrote:Enrico,
See what Viktor says:
"No, the closest is -w2."
With -w2 I still get the unused parameter warnings. Only using -w (or the equivalent -w1) I don't the the warnings.
![Sad :-(](./images/smilies/icon_sad.gif)
EMG
Re: Harbour warning
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Sun Mar 31, 2013 10:24 am
by Enrico Maria Giordano
nageswaragunupudi wrote:In both Harbour and xHarbour setting warning level to 2 ( -w2 ) generates warnings for variables declared but not used.
Again both in Harbour and xHarbour setting warning level to 1 ( -w1 ) does not generate these warnings.
So, normally I use -w1 and use -w2 occasionally for the purpose of removing unwanted declarations in the code.
I find both Harbour and xHarbour behaving the same way. Am I missing something?
xHarbour offers -wb- to disable unused codeblock parameters warning.
EMG
Re: Harbour warning
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Sun Mar 31, 2013 10:26 am
by Enrico Maria Giordano
As I'm not willing to reduce my level of warnings, I simply can't use Harbour.
![Sad :-(](./images/smilies/icon_sad.gif)
EMG
Re: Harbour warning
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Sun Mar 31, 2013 3:57 pm
by Antonio Linares
Enrico,
You could compile first with xHarbour and then recompile with Harbour. A weird solution but it is a solution
![Smile :-)](./images/smilies/icon_smile.gif)
Re: Harbour warning
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Sun Mar 31, 2013 5:07 pm
by Enrico Maria Giordano
Antonio Linares wrote:Enrico,
You could compile first with xHarbour and then recompile with Harbour. A weird solution but it is a solution
![Smile :-)](./images/smilies/icon_smile.gif)
Thank you Master! For a while, it can be an acceptable solution, in order to try Harbour.
![Smile :-)](./images/smilies/icon_smile.gif)
But please, can you insist with the Harbour developers if they could add something like xHarbour's /wb-?
![Smile :-)](./images/smilies/icon_smile.gif)
EMG