Infinite Compile
#1

why if i do this
pawn Код:
native mysql_function_query(connectionHandle, query[], bool:cache, callback[], format[], {Float,_}:...);

#define LOAD_mysql_function_query(%1) \
    if(!LoadInfo[Loaded]) LoadInfo[Query]++;\
    mysql_function_query(%1)

#if defined _ALS_mysql_function_query
    #undef mysql_function_query
#else
    #define _ALS_mysql_function_query
#endif
#define mysql_function_query LOAD_mysql_function_query
and then use mysql_function_query

the compiling process never end for me?
Reply
#2

#define LOAD_mysql_function_query(%1) \
if(!LoadInfo[Loaded]) LoadInfo[Query]++;\
mysql_function_query(%1)

looks odd to me. Try this:

#define LOAD_mysql_function_query(%1) if(!LoadInfo[Loaded]) mysql_function_query(%1), LoadInfo[Query]++

or perhaps even

#define LOAD_mysql_function_query(%1); if(!LoadInfo[Loaded]) { mysql_function_query(%1); LoadInfo[Query]++; }
Reply
#3

Quote:
Originally Posted by MP2
Посмотреть сообщение
#define LOAD_mysql_function_query(%1) \
if(!LoadInfo[Loaded]) LoadInfo[Query]++;\
mysql_function_query(%1)

looks odd to me. Try this:

#define LOAD_mysql_function_query(%1) if(!LoadInfo[Loaded]) mysql_function_query(%1), LoadInfo[Query]++

or perhaps even

#define LOAD_mysql_function_query(%1); if(!LoadInfo[Loaded]) { mysql_function_query(%1); LoadInfo[Query]++; }
is not equal to this

pawn Код:
#define LOAD_mysql_function_query(%1) \
    if(!LoadInfo[Loaded]) LoadInfo[Query]++;\
    mysql_function_query(%1)
perhaps did you mean

pawn Код:
#define LOAD_mysql_function_query(%1) \
    if(!LoadInfo[Loaded]) {LoadInfo[Query]++;} mysql_function_query(%1)
however is this thath causate the problem

pawn Код:
#define mysql_function_query LOAD_mysql_function_query
In my gm I created macros that look like this

pawn Код:
// native MySQLSelectStrOrderBy(query, len, select[], table[], field[], fieldval, order[],bool:cache, callback[], format[],{Float, _}:...);
#define MySQLSelectStrOrderBy(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9) \
    new val2[256]; \
    mysql_real_escape_string(%5,val2); \
    format(%0, %1, "SELECT %s FROM `%s` WHERE `%s` = '%s' ORDER BY %s", %2,%3,%4,%5,%6); \
    mysql_function_query(ConnectionHandle,%0,%7,%8,%9)
in which use the function mysql_function_query already redifined
is what can cause the problem?
Reply
#4

LOAD_mysql_function_query is calling mysql_function_query which then calls LOAD_mysql_function_query again and it keeps on going in a circle.
Reply
#5

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
LOAD_mysql_function_query is calling mysql_function_query which then calls LOAD_mysql_function_query again and it keeps on going in a circle.
What Sorry but why?? i can't redefine a native function whit a macro

isn't the same as this??
pawn Код:
stock LOAD_mysql_function_query(connectionHandle, query[], bool:cache, callback[], format[], {Float,_}:...)
{
    if(!LoadInfo[Loaded]) LoadInfo[Query]++;
   return mysql_function_query(connectionHandle, query, cache, callback, format, /*for pass the other elements i need to use the #emit function but i don't know how*/);
}

#if defined _ALS_mysql_function_query
    #undef mysql_function_query
#else
    #define _ALS_mysql_function_query
#endif
#define mysql_function_query LOAD_mysql_function_query
This type of redefinition don't go in an infinite recursion why with the macro should go
Reply
#6

BUMP
Reply
#7

BUMP
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)