SA-MP Forums

Go Back   SA-MP Forums > Search Forums

Showing results 1 to 13 of 13
Search took 0.00 seconds.
Search: Posts Made By: Yashas
Forum: Discussion 13/01/2018, 05:20 PM
Replies: 709
Views: 165,982
Posted By Yashas
Re: Today I learned - Share your newly found knowledge!

Destructors in PAWN

This is not documented in the PAWN Language Guide which is why this feature was unknown for quite a long time (11 years?). The implementer guide hints about destructors at few...
Forum: Discussion 21/07/2016, 12:31 PM
Replies: 709
Views: 165,982
Posted By Yashas
Re: Today I learned - Share your newly found knowledge!

Fixed a typo in the example. You can avoid the +3 and thats it!

Of course, its stupid to do such useless optimizations because it murders the readablity.

In the example, I try to copy a string...
Forum: Discussion 21/07/2016, 11:37 AM
Replies: 709
Views: 165,982
Posted By Yashas
Flowers Re: Today I learned - Share your newly found knowledge!

Today I learned that the fact that PAWN arranges static/global data linearly can be 'abused'.


static hello[] = {''H','e','l','l','o'}, world[]={' ', 'W', 'o', 'r', 'l', 'd', '!', 0};...
Forum: Discussion 08/08/2015, 05:04 AM
Replies: 709
Views: 165,982
Posted By Yashas
Re: Today I learned - Share your newly found knowledge!

It is because \ is used to tell that compiler that the line hasn't ended yet.


#define TEST "ABCDEFG \
HIJKLMN \
OPQRSTUVWXYZ"


And the error which you get when you do that on a comment...
Forum: Discussion 04/07/2015, 05:40 PM
Replies: 709
Views: 165,982
Posted By Yashas
Re: Today I learned - Share your newly found knowledge!

new src[] =" asdasdasldnasl \
asdasdasd \
asdasd \
asdasd";

Multiple Lines in strings!
Forum: Discussion 21/06/2015, 11:38 AM
Replies: 709
Views: 165,982
Posted By Yashas
Re: Today I learned - Share your newly found knowledge!

It will cause a warning only if I use both return; and return [expression]; in the same function.
Forum: Discussion 21/06/2015, 10:39 AM
Replies: 709
Views: 165,982
Posted By Yashas
Forum: Discussion 09/06/2015, 06:57 PM
Replies: 709
Views: 165,982
Posted By Yashas
Re: Today I learned - Share your newly found knowledge!

LOL Did "printf(" %d ms", GetTickCount() - a);" make a difference?
Forum: Discussion 09/06/2015, 06:01 PM
Replies: 709
Views: 165,982
Posted By Yashas
Re: Today I learned - Share your newly found knowledge!

Sorry for the bad example! :P Here is the correct code :|

a = GetTickCount();
for(new i; i != 10000000; i++)
{
new j = 0;
while(str[j++]...
Forum: Discussion 24/05/2015, 02:52 PM
Replies: 709
Views: 165,982
Posted By Yashas
Re: Today I learned - Share your newly found knowledge!

while(str[++j] == ' ') {}

This is slower than the one given below

while(str[j] == ' ') { j++;}
Forum: Discussion 12/04/2015, 09:26 AM
Replies: 709
Views: 165,982
Posted By Yashas
Re: Today I learned - Share your newly found knowledge!

Today I learned that


#if defined myfunc


works!

You can use function identifiers in #if !
Forum: Discussion 14/02/2014, 12:45 PM
Replies: 709
Views: 165,982
Posted By Yashas
Re: Today I learned - Share your newly found knowledge!

because such if blocks are used frequently and I needed to know which was faster!
Forum: Discussion 14/02/2014, 04:20 AM
Replies: 709
Views: 165,982
Posted By Yashas
Re: Today I learned - Share your newly found knowledge!

Today I learned that
if()
else

is faster than
if()
return or continue or whatever
some code to handle else

#include <a_samp>
Showing results 1 to 13 of 13

 

All times are GMT. The time now is 10:18 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.