Wrong Compiler Warning (minor problem)

47 views
Skip to first unread message

Raul Almeida

unread,
May 21, 2013, 9:57:54 AM5/21/13
to harbou...@googlegroups.com
I'd like to report a minor compiler warning problem.

When I compile a code like the one below compiler gives this warning: Warning W0004  Codeblock parameter 'E' declared but not used in function '*****************'
"
...
LOCAL aIndexes := {}
aEval( aDbs, { |e| aAdd( aIndexes, e->( ordkey() ) ) } )
...
"

It doesn't consider the alias pushing as a variable use.

Harbour 3.2.0dev (Rev. 18738)

Regards,
Raul Almeida

"José M. C. Quintas"

unread,
May 21, 2013, 11:45:35 AM5/21/13
to harbou...@googlegroups.com
warning ok, is not the alias.

change:
{ |e| aadd(...) }

to:
{ || aadd(...) }

Jos� M. C. Quintas

Raul Almeida

unread,
May 21, 2013, 12:10:50 PM5/21/13
to harbou...@googlegroups.com
JoséQuintas, please look carefully to the code.. the variable e is used and needed!
"
...
LOCAL aIndexes := {}
aEval( aDbs, { |e| aAdd( aIndexes, e->( ordkey() ) ) } )
...
"

On Tuesday, May 21, 2013 12:45:35 PM UTC-3, JoséQuintas wrote:
warning ok, is not the alias.

change:
{ |e| aadd(...) }

to:
{ || aadd(...) }

Jos� M. C. Quintas

Fábio Uggeri

unread,
May 21, 2013, 12:33:32 PM5/21/13
to harbou...@googlegroups.com
The e word is not a variable. It is an alias.


2013/5/21 Raul Almeida <raul...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Harbour Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-deve...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

to...@personamedical.com

unread,
May 21, 2013, 12:33:53 PM5/21/13
to harbou...@googlegroups.com
Raul,
The warning is correct.  In the code block as you have it, e is a literal work area. To make it work correctly, you need parenthesis around e to use the value that is stored in e as the alias:

LOCAL aIndexes := {}
aEval( aDbs, { |e| aAdd( aIndexes, (e)->( ordkey() ) ) } )


Regards,
tq

Raul Almeida

unread,
May 21, 2013, 12:38:42 PM5/21/13
to harbou...@googlegroups.com
Ohh.. that's true.
Thanks a lot man. Sorry for the false alarm.
Reply all
Reply to author
Forward
0 new messages