[Question]Dudb and ret_memcpy
#1

Hello there,

I use the dudb library by dracoblue and i have a warning saying "symbol ret_memcpy" isn't used";
i know i can simply add the preprocessor directive "#pragma unused ret_memcpy" but ui'm curious and i would like to know why we get this warning everytime we use this include ?

What is this "symbol wich is never used ? (i guess it's a consstant).

Anyway, sorry for my bad english ^^
Reply
#2

pawn Код:
ret_memcpy(source[],index=0,numbytes) {
    new tmp[MAX_STRING];
    new i=0;
    tmp[0]=0;
    if (index>=strlen(source)) return tmp;
    if (numbytes+index>=strlen(source)) numbytes=strlen(source)-index;
    if (numbytes<=0) return tmp;
    for (i=index;i<numbytes+index;i++) {
        tmp[i-index]=source[i];
        if (source[i]==0) return tmp;
    }
    tmp[numbytes]=0;
    return tmp;
}
It's a function in the dutils library but this func' is called 3 time in this library so why the pawn compiler say "unused" ?
Reply
#3

pawn Код:
ret_memcpy(source[],index=0,numbytes) {
    new tmp[MAX_STRING];
    new i=0;
    tmp[0]=0;
    if (index>=strlen(source)) return tmp;
    if (numbytes+index>=strlen(source)) numbytes=strlen(source)-index;
    if (numbytes<=0) return tmp;
    for (i=index;i<numbytes+index;i++) {
        tmp[i-index]=source[i];
        if (source[i]==0) return tmp;
    }
    tmp[numbytes]=0;
    return tmp;
}
See Its Here
Reply
#4

Yea but why the hell does it say "unused" thought this function is used ?
Reply
#5

thats beacause you still didnt use the funtion

on CMD:new(playerid,params[])

we use #pragma unused params

to avoid the warning from that params
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)