Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!yale!cs.yale.edu!jellinghaus-robert From: jellinghaus-robert@CS.Yale.EDU (Rob Jellinghaus) Newsgroups: comp.lang.eiffel Subject: How to use @ with attribute? Message-ID: <18296@cs.yale.edu> Date: 8 Mar 90 09:05:13 GMT Sender: news@cs.yale.edu Reply-To: jellinghaus-robert@CS.Yale.EDU (Rob Jellinghaus) Organization: Yale University Computer Science Dept, New Haven CT 06520-2158 Lines: 50 A short while ago, I attempted to post an article in which I decried Eiffel's lack of a class which would allow me to store and retrieve objects from memory, rather than to/from a file. I am attempting to integrate Eiffel with a networking utility, and I want to be able to store arbitrary Eiffel objects in a structure which can be passed between machines. The STORABLE class does what I want to do, but it can only read or write to disk, not to a buffer in memory. So rather than wait for ISE to add a store_to_memory function to the STORABLE class, I am implementing my own, by hacking the code in the _store.c and _retrieve.c files in /usr/licensed/Eiffel/files. And it's going well, except for this latest problem: I want to pass the address of a particular (integer) field of an object to a C routine I've written. The class looks something like this: class STORED_OBJECT ... feature hash_value: INTEGER; hash is external hash_object(current_obj: ANY, hash_val: ANY) language "C" do hash_object(Current, @hash) end end -- stored_object The idea is that I want my hash_object function to be able to reference the hash field of my Current object. But when I try to compile this code, it gives me: Pass 1 on class stored_object ... C-compiling stored_object "stored_object.c": line 125: unacceptable operand of & es: C-compilation canceled Why is this? Changing the declaration of hash_val from ANY to INTEGER doesn't help. Removing the @ sign in the call to hash_object removes the error, so I _know_ there's something wrong with the compiler or with my understanding of the @ operator. Can someone at ISE or elsewhere please help me out? I will have to hack around this in an ugly way if I don't get an answer. Thanks for any advice. Rob Jellinghaus | "Next time you see a lie being spread or a jellinghaus-robert@CS.Yale.EDU | bad decision being made out of sheer ignor- ROBERTJ@{yalecs,yalevm}.BITNET | ance, pause, and think of hypertext." {everyone}!decvax!yale!robertj | -- K. Eric Drexler, _Engines of Creation_