On May 6, 5:50 pm, "Jim Langston" <tazmas...@[EMAIL PROTECTED]
> wrote:
> Pete Becker wrote:
> > On 2008-05-06 06:26:32 -0400, "awhan.i...@[EMAIL PROTECTED]
"
> > <awhan.i...@[EMAIL PROTECTED]
> said:
>
> >> On May 6, 3:07 pm, "Jim Langston" <tazmas...@[EMAIL PROTECTED]
> wrote:
>
> >>> extern is the way you do it normally, other than passing the
> >>> variables as parameters.
>
> >>> --
> >>> Jim Langston
> >>> tazmas...@[EMAIL PROTECTED]
>
> >> thanks for the reply. yes i should have also mentioned that i did not
> >> want to pass the variables all the time. the reason i am looking for
> >> alternate ways is after learning that memory for global variables is
> >> reserved in the heap
>
> > Not usually. They go in the same memory area as static data.
>
> >> and a lot of global variables can create problems
> >> for a program.
>
> > Well, as far as memory usage, maybe. But more im****tant is that they
> > introduce sneak paths for data modification, which can make program
> > analysis and maintenance harder. Sometimes sharing is unavoidable, of
> > course.
>
> I have one project where I am forces to use global variables because of
the
> engine I am using having multiple callbbacks and it's impossible for me
to
> pass the data. One thing I did was I put all the global variables in a
> structure and have just one instance of the structure. I'm not sure if
it
> simplifies anything, but it helps.
>
> --
> Jim Langston
> tazmas...@[EMAIL PROTECTED]
structure idea is actually novel. how about if u just include the
prog that has the variables defined in them, and call a function from
the new one to the old one?
will that work?


|