Objective-C Issues

intermediate-code

People ( From: lines )
 Adam Fedor 
 Chris Petrilli 
 jsoft!ggf@uunet.uu.net (Gary Frederick)
Subjects ( 3 mails )
 questions...
 Re: questions... 
 Re: questions... (summary)
Document
Date: Tue, 5 Jan 93 16:19:59 -0700
From: Adam Fedor 
To: gnu-objc@prep.ai.mit.edu
Subject: questions...


These are some trivial questions, but I can't seem to get them answered 
anywhere else:

1:  When I compile an Obj-C program using gcc (Version 2.3.2) and -Wall, I
  get the following warning occuring N times, where N is (apparently) the number
  of methods I have in the class:

  List.m:299: warning: aggregate has a partly bracketed initializer

  Where line 299 is the line AFTER the last line in the file.  What does this 
  error mean?

2: Is there anyway to get gcc to give me the intermediate C code that is
  produced from the Objective-C code that I write?  i.e. I'd like to be able
  to write stuff in Objective-C, but give the programs to people who only have
  a C compiler.

3: Why does gcc not like "#import" statements?  It seems that
  using "#include" with the #ifndef _File_INCLUDE_ statements is kind of a
  ugly way to do this.

---
Adam Fedor. CU, Boulder		    | Fudd's Law of Opposition: Push something  
fedor@boulder.colorado.edu (W)      |   hard enough and it will fall over. 
adam@bastille.rmnug.org (H,NeXTMail)|

To: Adam Fedor 
Cc: gnu-objc@prep.ai.mit.edu
Subject: Re: questions... 
In-Reply-To: (Your message of Tue, 05 Jan 93 16:19:59 MST.)
             <9301052319.AA27146@focus.colorado.edu> 
Date: Tue, 05 Jan 93 18:16:18 -0600
From: Chris Petrilli 


>>>>> On Tue, 5 Jan 93 16:19:59 -0700, Adam Fedor
>>>>>  said:


Adam> 2: Is there anyway to get gcc to give me the intermediate C code
Adam> that is produced from the Objective-C code that I write?  i.e.
Adam> I'd like to be able to write stuff in Objective-C, but give the
Adam> programs to people who only have a C compiler.

Bzzz... thank you for playing :-) GCC doesn't generate anything like C
from Objective-C, but instead generates a "generic" pseudocode (RTL I
believe it's called).  This is portable between GCCs on different
platforms, but not to other compilers.  You could theoretically run
the second pass manually I guess to convert this to object code.  But
Objective-C is not translated a'la C-front code for C++.

Chris

Date: Wed, 6 Jan 93 21:55:51 -0700
From: jsoft!ggf@uunet.uu.net (Gary Frederick)
To: gnu-objc@prep.ai.mit.edu
Subject: Re: questions... (summary)
Reply-To: ggf@jsoft.com

Adam Fedor asked:
> 2: Is there anyway to get gcc to give me the intermediate C code that is
>   produced from the Objective-C code that I write?

I was able to get enough info out of the .s file to write C that worked like 
Objective C.  It helped clarify the documentation on the NeXT Objective C funtions.

for example

  ...
Integer *myValue = [Integer new: 17];

[myValue increment:21];
[myValue print];
 ...

can probably be written in C

  myValue = msgSend(getClass("Integer"), getUid("init:"), 17);
  msgSend(myValue, getUid("increment:"), 21);
  msgSend(myValue, getUid("print"));

NOTE:  I have not tested the C code above.  I did get something like the above to 
work with Modula-2 calling Objective-C.  C should be easier.

Gary
ggf@jsoft.com

Statistics
 filename:           intermediate-code
 number of mails:    3
 number of writers:  3
 line count:         93
 word count:         485
 character count:    3165

created by Helge Hess ( helge@mdlink.de )
MDlink online service center ( www.mdlink.de )