Raised This Month: $ Target: $400
 0% 

Whats the advatage of using bool`s over int ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
EKS
Veteran Member
Join Date: Mar 2004
Location: Norway
Old 04-20-2004 , 12:03   Whats the advatage of using bool`s over int ?
Reply With Quote #1

Im wondering whats the advatage of using bools instead of int`s ?

Normaly i just int`s with the value 0 or 1. But iv noticed some plugins uses bool`s. ( wich has true or false )

Im just wondering why? It seems to be to be 2 ways of doing the same thing, but if a bool stores 4 chars to save the same info as my int. Witch only has to store 0/1 it seems ints should be better.

Im just wondering.
EKS is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 04-20-2004 , 12:07  
Reply With Quote #2

Well, I guess there isn't much difference (both logically work the same), but I persoanlly prefer Bool over INT in such cases because an Int is ussually more bytes of memory than a bool variable..

Also, I personally like bool's 'cause my IDE highlights true/false but not 1/0.. so for me, it is visually easier to read!!

Edit: bool is not storing 4 or 5 chars, it is storing one byte (or cell), and the word True or False is a symbol, not a string...
xeroblood is offline
Send a message via MSN to xeroblood
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 04-20-2004 , 12:19  
Reply With Quote #3

a bool takes a cell. So there isn't any size difference between a bool and a normal int variable. The compiler will probably give you a warning when you assign a "normal" value to a bool.
__________________
hello, i am pm
PM is offline
AssKicR
Veteran Member
Join Date: Mar 2004
Location: Norway-Europe(GTM+1)
Old 04-20-2004 , 12:24  
Reply With Quote #4

i think using a bool is more logical..
__________________
My Plugins

Got ??
AssKicR is offline
ThorW634
Member
Join Date: Aug 2004
Location: Zeal
Old 04-20-2004 , 16:09  
Reply With Quote #5

define cell?
ThorW634 is offline
Send a message via AIM to ThorW634
IceMouse[WrG]
Senior Member
Join Date: Mar 2004
Old 04-20-2004 , 16:11  
Reply With Quote #6

A cell of memory... A byte
You can't set aside individual bits, I don't think... Just because of how it stores memory... Each hex/oct thing points to a byte in memory... Theres no pointer to 0xAB465F.5
IceMouse[WrG] is offline
Send a message via AIM to IceMouse[WrG] Send a message via MSN to IceMouse[WrG] Send a message via Yahoo to IceMouse[WrG]
BAILOPAN
Join Date: Jan 2004
Old 04-20-2004 , 16:14  
Reply With Quote #7

every variable in amxx is a cell (or an array is a bunch of cells). a cell is a 4byte block of memory.

or when we start distributing 64 bit* AMXx, it will become 8bytes
__________________
egg
BAILOPAN is offline
EKS
Veteran Member
Join Date: Mar 2004
Location: Norway
Old 04-20-2004 , 18:15  
Reply With Quote #8

Quote:
Originally Posted by BAILOPAN
every variable in amxx is a cell (or an array is a bunch of cells). a cell is a 4byte block of memory.

or when we start distributing 64 bit* AMXx, it will become 8bytes
so basicly it does not mather? , Just a mather of what you think is the most logical.
EKS is offline
BAILOPAN
Join Date: Jan 2004
Old 04-20-2004 , 18:50  
Reply With Quote #9

yes you are correct that "it does not matter", all the datatypes are essentially the same.

bool is simply more organized and makes things easier to read.
__________________
egg
BAILOPAN is offline
Reply


Thread Tools
Display Modes

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 10:15.


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