Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Re: sharing var...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 7 Topic 45771 of 47034
Post > Topic >>

Re: sharing variables across mulitple files

by Pete Becker <pete@[EMAIL PROTECTED] > May 6, 2008 at 07:00 AM

On 2008-05-06 06:26:32 -0400, "awhan.iitk@[EMAIL PROTECTED]
" 
<awhan.iitk@[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.

-- 
  Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The 
Standard C++ Library Extensions: a Tutorial and Reference 
(www.petebecker.com/tr1book)
 




 7 Posts in Topic:
sharing variables across mulitple files
"awhan.iitk@[EMAIL P  2008-05-06 02:58:33 
Re: sharing variables across mulitple files
"Jim Langston"   2008-05-06 03:07:00 
Re: sharing variables across mulitple files
"awhan.iitk@[EMAIL P  2008-05-06 03:26:32 
Re: sharing variables across mulitple files
Pete Becker <pete@[EMA  2008-05-06 07:00:45 
Re: sharing variables across mulitple files
"Jim Langston"   2008-05-06 05:50:14 
Re: sharing variables across mulitple files
dizzy <dizzy@[EMAIL PR  2008-05-07 11:39:30 
Re: sharing variables across mulitple files
Cynic <nik.n.nair@[EMA  2008-05-06 19:26:22 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 3:07:46 CDT 2008.