473,465 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Static variables with variable names

Sorry for the confusing title - not quite sure what I'm after here.

I think need to have a static variable in a procedure, but the name of that
variable will be designated at run time. Also I don't know how many
variables I need until run time either!

Just to explain, I have a number of IP based door access control readers and
I need to retain a status flag about certain ones - I don't know which ones
until run time. The readers have names. So I might have:

static <my variable> as boolean

which will come out as static Reader_30 as boolean

There may be another way of doing this of course, such as properties.

-Jerry

Nov 23 '05 #1
2 1111
well in this situation i would create a structure that holds the required
info about the status ( boolean , string , integer values about the status
etc etc )
then store these structures in a hashtable or collection ( i prefer the
hashtable as it is the fastest )

now you can save these values with anny name you like , and can even check
for there existence in the lookup table

i could write you an example if you like the idea

regards

Michel Posseth


"Jerry Spence1" <je**********@somewhere.com> wrote in message
news:43***********************@ptn-nntp-reader04.plus.net...
Sorry for the confusing title - not quite sure what I'm after here.

I think need to have a static variable in a procedure, but the name of
that variable will be designated at run time. Also I don't know how many
variables I need until run time either!

Just to explain, I have a number of IP based door access control readers
and I need to retain a status flag about certain ones - I don't know which
ones until run time. The readers have names. So I might have:

static <my variable> as boolean

which will come out as static Reader_30 as boolean

There may be another way of doing this of course, such as properties.

-Jerry

Nov 23 '05 #2
I think I like that idea - but am not very knowledgable on it. If you have
an example I'd be grateful

-Jerry
"m.posseth" <mi*****@nohausystems.nl> wrote in message
news:eY**************@tk2msftngp13.phx.gbl...
well in this situation i would create a structure that holds the required
info about the status ( boolean , string , integer values about the status
etc etc )
then store these structures in a hashtable or collection ( i prefer the
hashtable as it is the fastest )

now you can save these values with anny name you like , and can even check
for there existence in the lookup table

i could write you an example if you like the idea

regards

Michel Posseth


"Jerry Spence1" <je**********@somewhere.com> wrote in message
news:43***********************@ptn-nntp-reader04.plus.net...
Sorry for the confusing title - not quite sure what I'm after here.

I think need to have a static variable in a procedure, but the name of
that variable will be designated at run time. Also I don't know how many
variables I need until run time either!

Just to explain, I have a number of IP based door access control readers
and I need to retain a status flag about certain ones - I don't know
which ones until run time. The readers have names. So I might have:

static <my variable> as boolean

which will come out as static Reader_30 as boolean

There may be another way of doing this of course, such as properties.

-Jerry


Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Connell Gauld | last post by:
Hi, I'm using VC++. I have a class called exClass defined in exClass.h exClass has a static variable, declared like this in the public section. static int exStaticVar; Below the class definition...
9
by: Bryan Parkoff | last post by:
I have noticed that C programmers put static keyword beside global variable and global functions in C source codes. I believe that it is not necessary and it is not the practice in C++. Static...
1
by: Gorilla | last post by:
I bound my package with EXPLAIN(YES), and it's got the following static SQL in it: EXEC SQL SELECT CARDF, RECLENGTH INTO :CARDF,:RECLENGTH FROM SYSIBM.SYSTABLES WHERE NAME = :TBNAME AND...
9
by: ur8x | last post by:
Hi, I was wondering if there is a difference between declaring a static variable outside of the method as oppose to declaring it as a local variable? Thanks.
9
by: AnandRaj | last post by:
Hi guys, I have a few doubts in C. 1. Why static declartions are not allowed inside structs? eg struct a { static int i; }; Throws an error ..
3
by: rwoo_98 | last post by:
Does anyone know the difference between defining a static variable inside Global vs using an Application variable? For example Using a static int variable. public class Global :...
53
by: fdmfdmfdm | last post by:
This is an interview question and I gave out my answer here, could you please check for me? Q. What are the memory allocation for static variable in a function, an automatic variable and global...
14
by: Jess | last post by:
Hello, I learned that there are five kinds of static objects, namely 1. global objects 2. object defined in namespace scope 3. object declared static instead classes 4. objects declared...
37
by: minkoo.seo | last post by:
Hi. I've got a question on the differences and how to define static and class variables. AFAIK, class methods are the ones which receives the class itself as an argument, while static methods...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.