Raised This Month: $51 Target: $400
 12% 

#define s_is_number(%1) isdigit(%1)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 11-17-2012 , 10:30   #define s_is_number(%1) isdigit(%1)
Reply With Quote #1

Hello.

I want to change all amxmodx natives names, so it will be easy to me to remember those.
Each language use same function but different name it just confuses...

My question is how does computer see that
PHP Code:
#define s_is_number(%1) isdigit(%1) 
?

Is my way slower or are same like calling isdigit(ch)?
Thanks!
.Dare Devil. is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 11-17-2012 , 10:36   Re: #define s_is_number(%1) isdigit(%1)
Reply With Quote #2

The compiler just replace every s_is_number with isdigit.
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-17-2012 , 10:36   Re: #define s_is_number(%1) isdigit(%1)
Reply With Quote #3

What you do is a macro. If you write s_is_number, when you will compile the plugin, any occurrence of this name will be replaced by isdigit.
__________________
Arkshine is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 11-17-2012 , 12:20   Re: #define s_is_number(%1) isdigit(%1)
Reply With Quote #4

Quote:
Originally Posted by Neeeeeeeeeel.- View Post
The compiler just replace every s_is_number with isdigit.
Quote:
Originally Posted by Arkshine View Post
What you do is a macro. If you write s_is_number, when you will compile the plugin, any occurrence of this name will be replaced by isdigit.
Thanks!

One question more
if num_to_str( number, string[], ilen)
how #define s_number_to_string(?)
I cant remember how it goes ...

Last edited by .Dare Devil.; 11-17-2012 at 12:20.
.Dare Devil. is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 11-17-2012 , 12:21   Re: #define s_is_number(%1) isdigit(%1)
Reply With Quote #5

PHP Code:
#define s_number_to_string(%1,%2,%3) num_to_str(%1,%2,%3) 
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 11-17-2012 , 12:22   Re: #define s_is_number(%1) isdigit(%1)
Reply With Quote #6

Quote:
Originally Posted by YamiKaitou View Post
PHP Code:
#define s_number_to_string(%1,%2,%3) num_to_str(%1,%2,%3) 
are your sure?
%2 is string[] ?
.Dare Devil. is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 11-17-2012 , 12:23   Re: #define s_is_number(%1) isdigit(%1)
Reply With Quote #7

Have you tried it?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-17-2012 , 12:55   Re: #define s_is_number(%1) isdigit(%1)
Reply With Quote #8

formatex is faster

PHP Code:
#define s_number_to_string(%0,%1,%2)     formatex(%1,%2,"%d",%0) 
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-17-2012 , 14:07   Re: #define s_is_number(%1) isdigit(%1)
Reply With Quote #9

Please don't ever release plugins if you are going to do this. Don't ask for help with the code for that matter, you ruin readability for the community. It's better if you just learn something.
__________________

Last edited by fysiks; 11-17-2012 at 14:10.
fysiks is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 11-17-2012 , 14:09   Re: #define s_is_number(%1) isdigit(%1)
Reply With Quote #10

Zombie plague style. You CANT understand.
__________________
micapat is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:10.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode