September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
16
Task/Variable-size-Get/Gambas/variable-size-get.gambas
Normal file
16
Task/Variable-size-Get/Gambas/variable-size-get.gambas
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
Public Sub Main()
|
||||
|
||||
Print "Boolean =\t " & SizeOf(gb.Boolean)
|
||||
Print "Byte =\t\t " & SizeOf(gb.Byte)
|
||||
Print "Short =\t\t " & SizeOf(gb.Short)
|
||||
Print "Integer =\t " & SizeOf(gb.Integer)
|
||||
Print "Single =\t " & SizeOf(gb.Single)
|
||||
Print "Long =\t\t " & SizeOf(gb.Long)
|
||||
Print "Float =\t\t " & SizeOf(gb.Float)
|
||||
Print "Date =\t\t " & SizeOf(gb.Date)
|
||||
Print "String =\t " & SizeOf(gb.String)
|
||||
Print "Object =\t " & SizeOf(gb.Object)
|
||||
Print "Pointer =\t " & SizeOf(gb.Pointer)
|
||||
Print "Variant =\t " & SizeOf(gb.Variant)
|
||||
|
||||
End
|
||||
12
Task/Variable-size-Get/Kotlin/variable-size-get.kotlin
Normal file
12
Task/Variable-size-Get/Kotlin/variable-size-get.kotlin
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// version 1.1.2
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
/* sizes for variables of the primitive types (except Boolean which is JVM dependent) */
|
||||
println("A Byte variable occupies: ${java.lang.Byte.SIZE / 8} byte")
|
||||
println("A Short variable occupies: ${java.lang.Short.SIZE / 8} bytes")
|
||||
println("An Int variable occupies: ${java.lang.Integer.SIZE / 8} bytes")
|
||||
println("A Long variable occupies: ${java.lang.Long.SIZE / 8} bytes")
|
||||
println("A Float variable occupies: ${java.lang.Float.SIZE / 8} bytes")
|
||||
println("A Double variable occupies: ${java.lang.Double.SIZE / 8} bytes")
|
||||
println("A Char variable occupies: ${java.lang.Character.SIZE / 8} bytes")
|
||||
}
|
||||
1
Task/Variable-size-Get/Phix/variable-size-get.phix
Normal file
1
Task/Variable-size-Get/Phix/variable-size-get.phix
Normal file
|
|
@ -0,0 +1 @@
|
|||
printf(1,"An integer contains %d bytes.\n", machine_word())
|
||||
5
Task/Variable-size-Get/TXR/variable-size-get.txr
Normal file
5
Task/Variable-size-Get/TXR/variable-size-get.txr
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
struct foo {
|
||||
uint32_t x : 17;
|
||||
uint8_t y : 3;
|
||||
char z[16];
|
||||
};
|
||||
8
Task/Variable-size-Get/Zkl/variable-size-get.zkl
Normal file
8
Task/Variable-size-Get/Zkl/variable-size-get.zkl
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
(123).len() //-->1 (byte)
|
||||
(0).MAX.len() //-->8 (bytes), ie the max number of bytes in an int
|
||||
(1.0).MAX.len() //-->8 (bytes), ie the max number of bytes in an float
|
||||
"this is a test".len() //-->14
|
||||
L(1,2,3,4).len() //-->4
|
||||
Dictionary("1",1, "2",2).len() //-->2 (keys)
|
||||
Data(0,Int,1,2,3,4).len() //-->4 (bytes)
|
||||
Data(0,String,"1","2","3","4").len() //-->8 bytes (ASCIIZ)
|
||||
Loading…
Add table
Add a link
Reference in a new issue