Paavo Helde
10/14/2008 7:25:00 PM
"Angus" <nospam@gmail.com> kirjutas:
> I have a design which models a telephone system. Roughly the design
> has these two items:
>
> device class which models an extension on the telephone system. The
> device constructor takes a extension number. So program starts by
> creating a device object for each extension on the telephone system.
>
> Each device object contains a static list of calls.
If the "static list" means static data in the C++ sense, then no, each
device object does not contain a list of calls; all device objects are
rather sharing a single list.
Calls are
> modelled by a class object.
Sorry, cannot grok this...
> The class object takes an extension
> number in its destructor.
neither this...
I believe you should better post some sketch in C++ to get some useful
answers.
In general, static data is bad for reentrant code and for multithreading.
It should be used only if all running threads must see and/or alter the
same data state (with proper synchronization, of course). And if your
software is not using multithreading yet, the chances are good IMO that
it might to start to do that in a couple of years, just to make some use
of the multitude of cpu cores the new processors are sporting.
All the best
Paavo