FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Harbour warning
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Harbour warning
Posted: Sat Mar 30, 2013 05:38 PM
Dear friends, how do you compile the following sample using Harbour?

Code (fw): Select all Collapse
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    DEFINE DIALOG oDlg

    ACTIVATE DIALOG oDlg;
             ON INIT MSGINFO( "Hello" );
             CENTER

    RETURN NIL


I get:

Code (fw): Select all Collapse
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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Harbour warning
Posted: Sat Mar 30, 2013 06:23 PM

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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Harbour warning
Posted: Sat Mar 30, 2013 07:20 PM

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

Posts: 368
Joined: Sun May 31, 2009 06:25 PM
Re: Harbour warning
Posted: Sat Mar 30, 2013 08:06 PM
I got rid of theses warnings by using bInit codeblock

Code (fw): Select all Collapse
DEFINE DIALOG oDlg
oDlg:binit := { || whatever_you_need }
ACTIVATE DIALOG oDlg
Regards,



André Dutheil

FWH 13.04 + HB 3.2 + MSVS 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Harbour warning
Posted: Sat Mar 30, 2013 10:05 PM
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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Harbour warning
Posted: Sat Mar 30, 2013 10:56 PM
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
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Harbour warning
Posted: Sat Mar 30, 2013 11:49 PM

Thank you, Master! :-)

EMG

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Harbour warning
Posted: Sun Mar 31, 2013 04:49 AM

Enrico,

See what Viktor says:

"No, the closest is -w2."

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Harbour warning
Posted: Sun Mar 31, 2013 05:50 AM

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?

Regards



G. N. Rao.

Hyderabad, India
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Harbour warning
Posted: Sun Mar 31, 2013 10:24 AM
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. :-)

EMG
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Harbour warning
Posted: Sun Mar 31, 2013 10:24 AM
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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Harbour warning
Posted: Sun Mar 31, 2013 10:26 AM

As I'm not willing to reduce my level of warnings, I simply can't use Harbour. :-(

EMG

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Harbour warning
Posted: Sun Mar 31, 2013 03:57 PM

Enrico,

You could compile first with xHarbour and then recompile with Harbour. A weird solution but it is a solution :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Harbour warning
Posted: Sun Mar 31, 2013 05:07 PM
Antonio Linares wrote:Enrico,

You could compile first with xHarbour and then recompile with Harbour. A weird solution but it is a solution :-)


Thank you Master! For a while, it can be an acceptable solution, in order to try Harbour. :-)

But please, can you insist with the Harbour developers if they could add something like xHarbour's /wb-? :-)

EMG

Continue the discussion