[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is "static" meaningful in Objective-C methods?
From: |
M Lang / S Railsback |
Subject: |
Re: Is "static" meaningful in Objective-C methods? |
Date: |
Wed, 01 Nov 2000 14:45:41 -0800 |
Paul E Johnson wrote:
>
> <Naive C question alert>
> Using this in Swarm would let me get rid of a bunch of IVARS that hold
> values of seldom-used methods, so I could clean up some code. But I've
> not seen this in Swarm examples, and wonder if there is a danger of
> class instances corrupting or accidentally using each other's values for
> static variables.
We use static variables all the time, often for flag variables, as in:
- printSurvivalReport {
FILE * survReportPtr=NULL;
const char * survivalReport = "SurvivalTest.rpt";
static BOOL survReportFirstTime=YES;
if( survReportFirstTime == YES ) {
if( (survReportPtr = fopen(survivalReport, "w+")) == NULL ) {
[InternalError raiseEvent:"ERROR: Cannot open %s for
writing",survivalReport];
}
fprintf(survReportPtr,"%-15s%-15s%-15s%-15s%-15s%-15s%-15s%-15s%-15s%-15s%-19s%-15s%-15s%-15s%-15s%-17s%-15s%-15s\n","Species",
"Length",
"Weight", ...
Steve
--
address@hidden
Lang, Railsback & Assoc.
250 California Ave., Arcata CA 95521
707-822-0453; Fax 822-1868
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.