swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Swarm-Support] gcc and messages to nil. I'm needing help


From: Scott Christley
Subject: Re: [Swarm-Support] gcc and messages to nil. I'm needing help
Date: Sat, 12 Aug 2006 17:31:39 -0400

Hi Paul,

I think if you provide your own implementation of the nil_method function in your code, it will override the one in the ObjC runtime.  This relies upon a linking trick so it may not work on all platforms.  Try adding this into one of your source files


id
nil_method (id receiver, SEL op, ...)
{
  raiseEvent (InvalidArgument,  "The message `%s' was sent to nil.\n",
              sel_get_name (op));
  return nil;
}

then do a method call to nil to see if it works.

Probably it would be a good idea to log a bug/feature request with GCC to allow nil_method to be re-defined by applications; this was done for memory allocation functions that the ObjC runtime uses.

cheers
Scott

On Aug 11, 2006, at 4:26 PM, Paul Johnson wrote:

In the recent past, Swarm programs would stop with an error if a message was sent to nil. 
Now, In Fedora Core 4 and 5, gcc-4.X, the behavior of the compiler has been changed. I think now it matches the behavior described in the Objective-C book that Apple circulates, which holds that messages to nil do not produce a warning or error.  This causes bad bad problems for me/us.  One problem, which we discovered last month, is that even when Swarm's init fails to create lispArchiver and lispAppArchiver, the program continues and generates some bogus outcomes.  Now I noticed while working on an FC4 system that an improperly created distribution was resulting in a nil, and then repeated calls for "getDoubleSample" were returning crap, but no warnings or errors.

So I wish I could make gcc behave like it did in the old days, so that a program would stop and tell us when a message is sent to a nil.  And where in the code it happens. 
pj

-- 
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ku.edu/~pauljohn
1541 Lilac Lane, Rm 504                              University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66044-3177           FAX: (785) 864-5700

_______________________________________________
Support mailing list


reply via email to

[Prev in Thread] Current Thread [Next in Thread]