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

Im curious Why "sz"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 05-05-2015 , 15:48   Im curious Why "sz"
Reply With Quote #1

Hello there.
Lol.Just to know im curious, usually i see char's sz before a variable name.
i always seen this, i dont know what it means, but i self keep doing that too.
__________________
ghost95v is offline
Send a message via Skype™ to ghost95v
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-05-2015 , 15:58   Re: Im curious Why "sz"
Reply With Quote #2

It's called Hungarian notation and sz stands for "zero-terminated string". I would not recommend to use that, it's ugly and makes code less readable. It could be useful in some situations, but most of time if you name properly your variables, it's pointless ; especially in Pawn where there is no types.
__________________

Last edited by Arkshine; 05-05-2015 at 15:58.
Arkshine is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 05-05-2015 , 16:16   Re: Im curious Why "sz"
Reply With Quote #3

Yea u right. also i taked a look at all default codes maded by the AMX Mod X Team...
and there's no things named like that.
__________________
ghost95v is offline
Send a message via Skype™ to ghost95v
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-05-2015 , 19:37   Re: Im curious Why "sz"
Reply With Quote #4

I like using Hungarian notation in my plugins and think it actually improves readability (especially because it's a typeless language). It helps with context. For example, it's convenient for when you do something like this:

iMyNumber = str_to_num(szMyNumber)

They have the same base name because they both represent the same value. However, they need to be interpreted differently in the code because one is an integer and the other is a string.
__________________

Last edited by fysiks; 05-05-2015 at 19:38.
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 14:08.


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