On 06.08.2007, at 00:37, Vincent Geddes wrote:
I am experimenting with Objective-C, and I am trying to create some custom string classes.

The problem is that the gcc '-fconstant-string-class' option only seems to allow custom classes which subclass `Object' (in the GNU runtime).

Thats definitely wrong, the class doesn't matter (in both, gstep-base and libFoundation NSConstantString inherits from NSObject, not Object).

The thing which _is_ required (for rather obvious reasons?) is the constant ivar layout, which is
  - Class isa;
  - uchar *; // string
  - uint;    // length

gcc keeps on giving me the error `interface 'GooConstantString' does not have valid constant string layout' if I subclass anything other than `Object'.

Well, its because the ivar layout doesn't match the required constant one?!

Interfaces:
@interface GooObject
...
@end
@interface GooString : GooObject
...
@end
@interface GooConstantString : GooString
{
  Class isa;
  char *c_string;
  unsigned int len;
}
@end

Well, you don't give the ivar layout of your hierarchy (...?). Eg that GooConstantString has an 'isa' ivar looks utterly wrong given that any object needs to have an isa pointer (=> it has to be in your root class). Maybe removing the 'isa' does the trick?

Greets,
  Helge
--
Helge Hess
http://www.helgehess.eu/




_______________________________________________
Gnustep-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to