Raised This Month: $32 Target: $400
 8% 

Split string


Post New Thread Reply   
 
Thread Tools Display Modes
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-09-2017 , 22:39   Re: Split string
Reply With Quote #11

Quote:
Originally Posted by SpawnerF View Post
edit : sizeof is a pre-processor function?
Yes. If an array is declared such as:

Code:
new myArray[54]
then

Code:
new Size_of_myArray = sizeof(myArray)
will be compiled as if the code is:

Code:
new Size_of_myArray = 54
So, if the dimension is not defined, it shouldn't work.
__________________

Last edited by fysiks; 07-09-2017 at 22:39.
fysiks is offline
SpawnerF
Member
Join Date: Apr 2017
Location: Morocco
Old 07-10-2017 , 10:51   Re: Split string
Reply With Quote #12

but is it really a pre-processor function?

Using -l argument in the compiler "-l create list file (preprocess only)"

using charsmax shows
Code:
new Size_of_myArray = (sizeof(myArray)-1)
using sizeof shows
Code:
new Size_of_myArray = sizeof(myArray)
So is it replaced at the compilation or not?

creating something like that
Code:
#define size 30
will be replaced like that :
Code:
new Size_of_myArray = 30
__________________
XX was created just for giving evidence and not meant to damage public servers.
&We do not test on public servers.
Thank's.

Last edited by SpawnerF; 07-10-2017 at 10:51.
SpawnerF is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-10-2017 , 22:20   Re: Split string
Reply With Quote #13

If you have further questions about the Pawn language, I recommend that you consult the Pawn Language Guide.
__________________
fysiks is offline
SpawnerF
Member
Join Date: Apr 2017
Location: Morocco
Old 07-10-2017 , 23:03   Re: Split string
Reply With Quote #14

Thanks but I searched yesterday on the new guide package didn't find anything intresting related to sizeof.

I just need to understand something, if it's a pre-processor directive then why it is not resolved during the first stage which is "preprocessing"? ( You can check that using "-l" argument in the compiler "amxxpc.exe" )

So the value evaluates at compile time means that sizeof isn't a pre-processor directive.

btw it's an operator not a function.

Edit+ :
Quote:
Originally Posted by VEN View Post
sizeof isn't a preprocessor directive, it's a pawn operator.
__________________
XX was created just for giving evidence and not meant to damage public servers.
&We do not test on public servers.
Thank's.

Last edited by SpawnerF; 07-10-2017 at 23:35.
SpawnerF is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-10-2017 , 23:54   Re: Split string
Reply With Quote #15

If it's not a pre-processor directive then a very knowledgeable member of this community has misinformed people.

The only way to be really sure is to decompile a plugin and see what actually happens during compilation. I would do this but for some reason, the disassembler that I have does not seem to be working.

Anyways, this is way off-topic. Any further discussion about this should happen elsewhere in its own thread.
__________________

Last edited by fysiks; 07-10-2017 at 23:54.
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 19:10.


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