Zheng Hu | 10 Jun 16:09

How to use the address of "Current"

Hi again,

I want to send the address of Current object in a function parameter to another class! But I get an error message:
               ****** Fatal Error: Cannot use `Current' after the $ operator.
               The $ operator must be followed by the final name of a feature
               which is not a constant attribute or by the name of some local
               variable as well.

                My code looks like this:
                        class
                               ABC 
                        inherit
                               XYZ 

                       creation
                               make

                       feature

                               make is
                                    do
                                       Current.launch($Current)
                                    end
                     ----------------------------------------------------------------- 
                       class
                              XYZ

                       creation
                              make

(Continue reading)

Paolo Redaelli | 10 Jun 16:14
Favicon

Re: How to use the address of "Current"

Zheng Hu ha scritto:
> Hi again,
>
> I want to send the address of Current object in a function parameter to another class! But I get an error message:
> ...
> Any suggestions?
Use "to_pointer" feature, like this:

class ABC 
inherit XYZ
creation make 
feature 
	make is
		do
			launch(to_pointer)
		end
end
----

class XYZ
creation make
feature
	launch(my_obj:POINTER) is
		do
			foo(my_obj)
		end
end

Zheng Hu | 10 Jun 16:24

Re: How to use the address of "Current"

Thanks Paolo for your answer

-------- Original-Nachricht --------
> Datum: Tue, 10 Jun 2008 16:14:27 +0200
> Von: Paolo Redaelli <paolo.redaelli <at> poste.it>
> An: Zheng Hu <zheng.hu <at> gmx.de>
> CC: SmartEiffel <at> loria.fr
> Betreff: Re: How to use the address of "Current"

> Zheng Hu ha scritto:
> > Hi again,
> >
> > I want to send the address of Current object in a function parameter to
> another class! But I get an error message:
> > ...
> > Any suggestions?
> Use "to_pointer" feature, like this:
> 
> class ABC 
> inherit XYZ
> creation make 
> feature 
> 	make is
> 		do
> 			launch(to_pointer)
> 		end
> end
> ----
> 
> class XYZ
(Continue reading)

Dominique Colnet | 10 Jun 16:32
Favicon

Re: How to use the address of "Current"

Zheng Hu wrote:
> Hi again,
>
> I want to send the address of Current object in a function parameter to another class! But I get an error message:
>                ****** Fatal Error: Cannot use `Current' after the $ operator.
>                The $ operator must be followed by the final name of a feature
>                which is not a constant attribute or by the name of some local
>                variable as well.
>   
I presume you need to send the address of Current to some external C code ?
If the answer is yes, just remove the $ which is before Current :-)
See example in "SmartEiffel/tutorial/external/C/example1.e".

If you do not want to send the address of Current outside of the Eiffel 
world,
may be, you are doing something weird...
Hope this help,

--

-- 
--------------------------------------------------------------
Dominique.Colnet <at> loria.fr -- IUT Nancy Charlemagne -- LORIA
http://SmartEiffel.loria.fr  --  The GNU Eiffel Compiler
POST: Loria, B.P. 239,54506 Vandoeuvre les Nancy Cedex, FRANCE
Voice:+33 0354503827 Mobile: +33 0665362381 Fax:+33 0383913201


Gmane