[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Shadowed declaration

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Shadowed declaration
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Samson   USA  (683 posts)  [Biography] bio
Date Sun 25 Dec 2005 06:59 AM (UTC)  quote  ]
Message
That's because the "filename" variable is being declared twice. A shadow warning lets you know this was done since in some cases it can fubar the contents of the variable if you do that.

You should probably change the "filename" variable inside that for() loop to something else. I suggest "fname". This will avoid the possibility that you might end up overwriting something in memory that you don't want to.

( This also means I need to go back and check this code for errors since I'm the one hosting it :P )

SmaugMuds.org: http://www.smaugmuds.org - The Smaug MUDs Community Center

"The past was erased, the erasure was forgotten, the lie became truth." -- George Orwell, 1984
[Go to top] top

Posted by Zeno   USA  (2,867 posts)  [Biography] bio   Moderator
Date Sun 25 Dec 2005 01:29 AM (UTC)  quote  ]
Message
Try doing a search on the forums. For example, this comes up:
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=5703

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Metsuro   USA  (389 posts)  [Biography] bio
Date Sat 24 Dec 2005 11:03 PM (UTC)  quote  ]
Message
hometowns.c: In function `load_nations':
hometowns.c:328: warning: declaration of 'filename' shadows a previous local
hometowns.c:314: warning: shadowed declaration is here

{
FILE *list = NULL;
char filename[256]; - 314

/* load from nations list */
sprintf(filename, "%snations.lst", NATION_DIR);
if((list = fopen(filename, "r")) == NULL)
{
bug("load_nations(): cannot open %s for reading; aborting load", filename);
return;
}

top_nation = 0;

for( ; ; )
{
char *filename = feof(list) ? "$" : fread_string(list); - 328

not sure how to fix this or anything...

Everything turns around in the end
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


3,122 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]