Go to Post Robotic Football now thats something I would build 6 weeks for. - Nikkocharger [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 23-01-2008, 09:46
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
static local variables

Is there a correct way to define a variable inside a function as "static" so it retains a value between invocations of the function? I've resorted to a user code block in order to do it so far. Unfortunately, that doesn't make the variable "known" to the rest of the EasyC system -- it won't show up in the drop-down menus, for example.
  #2   Spotlight this post!  
Unread 23-01-2008, 10:11
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 861
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: static local variables

You can use a user code block and it must be in the first line of the function. Like you mentioned, shown below but you are correct it will not make the variable known. We had this in easyC for FRC 2 years ago and it caused allot of problems with users mis-using it.
Attached Thumbnails
Click image for larger version

Name:	static.JPG
Views:	124
Size:	8.6 KB
ID:	6100  
__________________
FIRST Team 501 PowerKnights - Mentor
FIRST Team 40 Checkmate - Mentor Alum
FIRST Team 146 Blue Lightning - Alumni
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why Static Variables? brianafischer Programming 13 26-01-2007 14:56
Static Cling?? orelinde Electrical 17 27-02-2006 17:33
Static Variables amateurrobotguy Programming 8 04-03-2005 00:40
Static Electricity JeffO Championship Event 5 19-04-2004 11:04
Static Electricity archiver 2001 12 24-06-2002 00:34


All times are GMT -5. The time now is 18:35.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi