Issue information

Issue ID
#6152
Status
Fixed
Severity
None
Started
Hercules Elf Bot
Jul 2, 2012 18:38
Last Post
Hercules Elf Bot
Nov 30, 2012 20:54
Confirmation
Yes (0)
No (3)

Hercules Elf Bot - Jul 2, 2012 18:38

Originally posted by [b]Seizure[/b]
skill.c: In function âskill_castend_nodamage_idâ:
skill.c:4548: warning: âiâ may be used uninitialized in this function


clean revision 16367

Hercules Elf Bot - Jul 2, 2012 19:43

Originally posted by [b]Mysterious[/b]
[CODE]
int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, int skillid, int skilllv, unsigned int tick, int flag)
{
struct map_session_data *sd, *dstsd;
struct mob_data *md, *dstmd;
struct homun_data *hd;
struct mercenary_data *mer;
struct status_data *sstatus, *tstatus;
struct status_change *tsc;
struct status_change_entry *tsce;
int i;
enum sc_type type;
[/CODE]

[b]int i;[/b] is giving you the error apparently. That's line 4548.

Are you sure you didnt add any customizations?

This post has been edited by Mysterious on Jul 2, 2012 20:06

Hercules Elf Bot - Jul 2, 2012 20:48

Originally posted by [b]Ind[/b]
Try to checkout r16368 let me know if it fixed for you.

Hercules Elf Bot - Jul 3, 2012 14:05

Originally posted by [b]Seizure[/b]
[CODE]
Checked out revision 16372.



CC script.c
CC storage.c
CC skill.c
skill.c: In function âskill_castend_nodamage_idâ:
skill.c:4548: warning: âiâ may be used uninitialized in this function
CC atcommand.c
CC battle.c
CC battleground.c
CC intif.c
CC trade.c
CC party.c
CC vending.c
CC guild.c
CC pet.c
CC log.c
CC mail.c
CC date.c
CC unit.c
CC homunculus.c
CC mercenary.c
CC quest.c
CC instance.c
CC buyingstore.c
CC searchstore.c
CC duel.c
CC pc_groups.c
CC elemental.c
CC mapreg_sql.c
LD map-server_sql


[/CODE]




what am I doing wrong><?

Hercules Elf Bot - Jul 3, 2012 14:44

Originally posted by [b]Vali[/b]
The use of variables inside an if condition that are being initialized in that if condition and used at the same time in the condition is a bad practice that may cause that warning and bigger problems. Here is a patch that I think must fix this problem.

Vali~

This post has been edited by Vali on Jul 3, 2012 15:49

Hercules Elf Bot - Jul 3, 2012 15:35

Originally posted by [b]malufett[/b]
[quote]The use of variables in a inf condition that are being initialized in that if condition and used at the same time in the condition is a bad practice that may cause that warning and bigger problems.[/quote]
for me its not a bad practice..because once the compiler reach the inline initialization of a variable in an if statement it would read it first before executing the condition so it still initialized but it must use wisely... :)

if Vali's patch doesn't fix it then initialize it...
[CODE]int i = 0;[/CODE] /no1

This post has been edited by malufett on Jul 3, 2012 15:36

Hercules Elf Bot - Jul 3, 2012 15:51

Originally posted by [b]Vali[/b]
Its legal and usable, I do it a lot of times too, but a bad practice. Some compilers like borland will tell you if you try to do it. :P

This post has been edited by Vali on Jul 3, 2012 15:52