Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUDs ➜ General ➜ SWRiP200 Compiling Error - cast from 'char*' to 'int' loses precision

SWRiP200 Compiling Error - cast from 'char*' to 'int' loses precision

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Chaoscayne   (8 posts)  Bio
Date Sat 29 Nov 2008 07:08 PM (UTC)

Amended on Sat 29 Nov 2008 07:58 PM (UTC) by Chaoscayne

Message
When I go to compile the code (swrip200) i got from swrip.net i get this odd error and i can't seem to figure out how to fix it.

OS : GNU bash, version 3.2.33(1)-release (x86_64-pc-linux-gnu)

Errors I'm Receiving:

handler.c: In function 'OBJ_DATA* group_object(OBJ_DATA*, OBJ_DATA*)':
handler.c:3553: error: cast from 'char*' to 'int' loses precision
handler.c:3553: error: cast from 'char*' to 'int' loses precision
handler.c:3554: error: cast from 'char*' to 'int' loses precision
handler.c:3554: error: cast from 'char*' to 'int' loses precision
handler.c:3555: error: cast from 'char*' to 'int' loses precision
handler.c:3555: error: cast from 'char*' to 'int' loses precision
handler.c:3556: error: cast from 'char*' to 'int' loses precision
handler.c:3556: error: cast from 'char*' to 'int' loses precision

Offending Lines of Code:

line:3553: && QUICKMATCH( obj1->name, obj2->name )
line:3554: && QUICKMATCH( obj1->short_descr, obj2->short_descr )
line:3555: && QUICKMATCH( obj1->description, obj2->description )
line:3556: && QUICKMATCH( obj1->action_desc, obj2->action_desc )


I'm just a bit confused and can't figure out what to do. did a make -k and got to see all the other files that have similar erros.....i see this in several of the files "cast from 'char*' to 'int' loses precision"
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #1 on Sat 29 Nov 2008 08:00 PM (UTC)

Amended on Sat 29 Nov 2008 08:13 PM (UTC) by Zeno

Message
Look into this:
http://www.smaugmuds.org/index.php?a=topic&t=1782

I would also recommend using FUSS versions.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Chaoscayne   (8 posts)  Bio
Date Reply #2 on Sat 29 Nov 2008 08:59 PM (UTC)
Message
Well that definatly fixed that error but i'm still getting the
cast from '<insertname>*' to 'int' loses precision
line during compile on several files.
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #3 on Sat 29 Nov 2008 09:07 PM (UTC)
Message
The same lines?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Chaoscayne   (8 posts)  Bio
Date Reply #4 on Sat 29 Nov 2008 09:09 PM (UTC)

Amended on Sat 29 Nov 2008 09:37 PM (UTC) by Chaoscayne

Message
fixed the other QUICKMATCH errors i was getting

Current lines and files i get errors on:

hashstr.c: In function 'void hash_dump(int)':
hashstr.c:180: error: cast from 'hashstr_data*' to 'int' loses precision
hashstr.c: In function 'void show_high_hash(int)':
hashstr.c:248: error: cast from 'hashstr_data*' to 'int' loses precision

165:void hash_dump( int hash )
166:{
167: struct hashstr_data *ptr;
168: char *str;
169: int c, psize;

171: if ( hash > STR_HASH_SIZE || hash < 0 )
172: {
173: fprintf( stderr, "hash_dump: invalid hash size\n\r" );
174: return;
175: }
176: psize = sizeof(struct hashstr_data);
178: for ( c=0, ptr = string_hash[hash]; ptr; ptr = ptr->next, c++ )
179: {
180: str = (char *) (((int) ptr) + psize);
181: fprintf( stderr, "Len:%4d Lnks:%5d Str: %s\n\r",
182: ptr->length, ptr->links, str );
183: }
184: fprintf( stderr, "Total strings in hash %d: %d\n\r", hash, c );
185:}

reset.c: In function 'void do_reset(CHAR_DATA*, char*)':
reset.c:996: error: cast from 'char*' to 'int' loses precision
reset.c: In function 'void do_rreset(CHAR_DATA*, char*)':
reset.c:1052: error: cast from 'char*' to 'int' loses precision
reset.c: In function 'void reset_area(AREA_DATA*)':
reset.c:1290: error: cast from 'char*' to 'int' loses precision

line 996 offending chunk of code:
{
AREA_DATA *tmp;

985: for ( tmp = first_build; tmp; tmp = tmp->next )
986: if ( tmp == pArea )
987: break;
988: if ( !tmp )
989: for ( tmp = first_area; tmp; tmp = tmp->next )
990: if ( tmp == pArea )
991: break;
992: if ( !tmp )
993: {
994: send_to_char("Your area pointer got lost. Reset mode off.\n\r", ch);
995: bug("do_reset: %s's dest_buf points to invalid area",
996: (int)ch->name);
997: ch->substate = SUB_NONE;
998: DISPOSE(ch->dest_buf);
999: return;
1000: }
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #5 on Sat 29 Nov 2008 09:21 PM (UTC)
Message
Which is line 996 in that chunk?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Chaoscayne   (8 posts)  Bio
Date Reply #6 on Sat 29 Nov 2008 09:38 PM (UTC)
Message
added line numbers to previous message
Top

Posted by Chaoscayne   (8 posts)  Bio
Date Reply #7 on Sat 29 Nov 2008 10:34 PM (UTC)
Message
got it now.....simple stuff once my brain kicked in
thanks for the help file
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.


26,133 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.