about var inits

This commit is contained in:
Irmen de Jong 2024-10-21 21:20:47 +02:00
parent 7585b6ef6f
commit 9927af1095
3 changed files with 2 additions and 6 deletions

View File

@ -85,7 +85,7 @@ class SymbolTableMaker(private val program: PtProgram, private val options: Comp
initialString = null
initialArray = null
val number = value.number
initialNumeric = if(number==0.0) null else number // 0 as init value -> just uninitialized TODO weird?
initialNumeric = number
numElements = node.arraySize?.toInt()
}
}

View File

@ -471,6 +471,7 @@ internal class ProgramAndVarsGen(
private fun entrypointInitialization() {
// zero out the BSS area first, before setting the variable init values
// this is mainly to make sure the arrays are all zero'd out at program startup
asmgen.out(" jsr prog8_lib.program_startup_clear_bss")
// initialize block-level (global) variables at program start

View File

@ -1,11 +1,6 @@
TODO
====
In ast2 allow PtVariable to still have a numeric initialization value in codegen. (instead of only array and string)
why is 0 as value stored as null in symboltablemaker?
are variables initialized with 0 reset to 0 with an assignment? WHY is the BSS area then cleared with memset? shouldn't be necessary?
- unit test for defer
- describe defer in the manual