[Done] #Char

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

[Done] #Char

Post by Rescator »

As there is already #Long etc. and saves me/us the trouble of doing this: :)

Code: Select all

CompilerIf #PB_Compiler_Unicode
 #Char=2
CompilerElse
 #Char=1
CompilerEndIf

Debug #Char
Last edited by Rescator on Thu Sep 29, 2011 1:17 pm, edited 1 time in total.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

SizeOf(Character) will change from 1 to 2 if you enable unicode, which is a bit more efficient than the #CompilerIf approach.
BERESHEIT
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post by Rescator »

I know. and I just noticed somethingn else...

Try:
Debug #Quad
Debug #Long
Debug #Word
Debug #Byte


Am I just loosing my mind or didn't #Long return 4 in the past?
*scratches head*
I must have missed a memo somewhere...
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Those are constants unrelated to the size of the data they hold. SizeOf(Long) still returns 4.
BERESHEIT
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Rescator wrote:I know. and I just noticed somethingn else...

Try:
Debug #Quad
Debug #Long
Debug #Word
Debug #Byte


Am I just loosing my mind or didn't #Long return 4 in the past?
*scratches head*
I must have missed a memo somewhere...
#SizeOf_<datatype> was used in PB 3.94 but was dropped. Use SizeOf(<datatype>).
Post Reply