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

[SLVD] Pawn Cell Size


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Shooting King
RAAASENGAN
Join Date: Mar 2012
Location: India
Old 05-02-2015 , 13:24   [SLVD] Pawn Cell Size
Reply With Quote #1

Code:
// This is pawn code (amxmodx plugin)
new var;
1. What is the type and size of var ? Is it a Cell ?

2. What is the exact meaning of casting ? For what purposes are reinterpret cast and static cast are used ? Are there any more types of castings ?

3. In context of the following functions what does FP_STRINGEX (copy back string) mean ?
Code:
int MF_RegisterForward( const char *funcname, ForwardExecType exectype, ... );
int MF_RegisterSPForward( AMX *amx, int func, ... );
int MF_RegisterSPForwardByName( AMX *amx, const char *func, ... );
4.
Quote:
Originally Posted by moduleconfig.h
PHP Code:
#if !defined PAWN_CELL_SIZE
  #define PAWN_CELL_SIZE 32     /* by default, use 32-bit cells */
#endif
#if PAWN_CELL_SIZE==16
  
typedef uint16_t  ucell;
  
typedef int16_t   cell;
#elif PAWN_CELL_SIZE==32
  
typedef uint32_t  ucell;
  
typedef int32_t   cell;
#define REAL    float
#elif PAWN_CELL_SIZE==64
  
typedef uint64_t  ucell;
  
typedef int64_t   cell;
#define REAL    double
#else
  #error Unsupported cell size (PAWN_CELL_SIZE)
#endif 
Does pawn cell size change ? And how is that useful ?
__________________
As every time said, don't ever UNDERESTIMATE me.

Donate - Here

Last edited by Shooting King; 05-04-2015 at 15:46.
Shooting King is offline
hzqst
Senior Member
Join Date: Jul 2008
Old 05-02-2015 , 23:14   Re: Pawn Cell Size
Reply With Quote #2

1."cell" in amxx equal to "int" in c/c++, which means "new var;" = "int var;"
2.there is no need to use static_cast and reinterpret_cast.

Last edited by hzqst; 05-02-2015 at 23:17.
hzqst is offline
Shooting King
RAAASENGAN
Join Date: Mar 2012
Location: India
Old 05-03-2015 , 02:28   Re: Pawn Cell Size
Reply With Quote #3

Quote:
Originally Posted by hzqst View Post
1."cell" in amxx equal to "int" in c/c++, which means "new var;" = "int var;"
2.there is no need to use static_cast and reinterpret_cast.
1. Size of Cell is 4 Bytes always ?
2. What are their differences and when they are used ?

Thankyou.
__________________
As every time said, don't ever UNDERESTIMATE me.

Donate - Here
Shooting King is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-04-2015 , 15:26   Re: Pawn Cell Size
Reply With Quote #4

1. Like you quoted "by default, use 32-bit cells".
2. At this point, you should read some C/C++ tutorial, it will make more sense
3. This means that you can overwrite the content, it's basically an output buffer. If you create a forward to return a string, you can use that to pass string by reference. This forward http://www.amxmodx.org/api/amxmodx/inconsistent_file: last argument content can be changed.
4. The original Pawn version can be used on several system, could be probably useful depending the target environment I guess, but here for AMXX, you should not change, and it won't probably work properly anyway.
__________________
Arkshine is offline
Shooting King
RAAASENGAN
Join Date: Mar 2012
Location: India
Old 05-04-2015 , 15:34   Re: Pawn Cell Size
Reply With Quote #5

Quote:
Originally Posted by Arkshine View Post
1. Like you quoted "by default, use 32-bit cells".
4. The original Pawn version can be used on several system, could be probably useful depending the target environment I guess, but here for AMXX, you should not change, and it won't probably work properly anyway.
So, Amxx uses 32 Bit cells and that doesn't change. This makes sense.

Quote:
Originally Posted by Arkshine View Post
2. At this point, you should read some C/C++ tutorial, it will make more sense.


Thanks for the info, Arkshine.
__________________
As every time said, don't ever UNDERESTIMATE me.

Donate - Here
Shooting King is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 05-04-2015 , 18:44   Re: [SLVD] Pawn Cell Size
Reply With Quote #6

dynamic_cast, static_cast, reinterpret_cast, bad_cast, safe_cast and const_cast operators.
Read more at MSDN.
PAWN_CELL_SIZE is currently 32 everywhere so I guess the [#if defined #else #endif] check is useless for now.
__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
Shooting King
RAAASENGAN
Join Date: Mar 2012
Location: India
Old 05-05-2015 , 02:18   Re: [SLVD] Pawn Cell Size
Reply With Quote #7

Quote:
Originally Posted by claudiuhks View Post
dynamic_cast, static_cast, reinterpret_cast, bad_cast, safe_cast and const_cast operators.
Read more at MSDN.
PAWN_CELL_SIZE is currently 32 everywhere so I guess the [#if defined #else #endif] check is useless for now.
:yay: Direct link. Btw, claudiuhks whats the following casting method called ?

PHP Code:
// C++/C
float a  = (float)97
Thanks.
__________________
As every time said, don't ever UNDERESTIMATE me.

Donate - Here
Shooting King is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 05-05-2015 , 04:37   Re: [SLVD] Pawn Cell Size
Reply With Quote #8

Quote:
Originally Posted by Shooting King View Post
:yay: Direct link. Btw, claudiuhks whats the following casting method called ?

PHP Code:
// C++/C
float a  = (float)97
Thanks.
I can't answer you as a developer, but as I know, this is how to assign data to variables depending on their type.

PHP Code:
32-bit float A 97.f// 97.0f
64-bit double B 97.0;
32-bit long C 0L;
32-bit unsigned long D 0UL;
64-bit long long E 0LL;
64-bit unsigned long long F 0ULL;
32-bit int G 7195
Well, regarding float a = (float)97;
I don't think it's a requirement. It would be one, only if the next code is met.

PHP Code:
double K 12479125.0;
float L = (float)K// transferring 64-bit data to 32-bit variable. 
And I am still not sure about constants.
Anyways, I am pretty sure you will never assign a 64-bit constant value (very very long number) to a 32-bit variable.

You can read this to get the exact name.
__________________

Last edited by claudiuhks; 05-05-2015 at 04:45.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
Shooting King
RAAASENGAN
Join Date: Mar 2012
Location: India
Old 05-05-2015 , 09:54   Re: [SLVD] Pawn Cell Size
Reply With Quote #9

Ok. Thanks claudiuhks
__________________
As every time said, don't ever UNDERESTIMATE me.

Donate - Here
Shooting King is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-05-2015 , 19:44   Re: [SLVD] Pawn Cell Size
Reply With Quote #10

Quote:
Originally Posted by Shooting King View Post
whats the following casting method called ?

PHP Code:
// C++/C
float a  = (float)97
Isn't that just a cast? Is there more than one type of cast in C/C++?
__________________
fysiks 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 13:32.


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