np clyde. Done a little more investigation into this and found some strange things that the compiler does even though it doesn't make any difference to what i've said above.
if v=3.5 i get the code (I've added some comments to this at ###)
.section .text
.balign 16
.globl _main
_main:
push ebp
mov ebp, esp
and esp, 0xFFFFFFF0
call ___main
push dword ptr [ebp+12]
push dword ptr [ebp+8]
call _fb_Init@8
call _fb_CallCTORS
.Lt_0001:
###load as double from Lt_0003
fld qword ptr [Lt_0003]
###store as integer in 'i'
fistp dword ptr [_I]
###load again as double from Lt_0003
fld qword ptr [Lt_0003]
###store as single in 'f'
fstp dword ptr [_F]
###push the double value onto the stack
push dword ptr [Lt_0003]
push dword ptr [Lt_0003+4]
###pop the double value off the stack into 'd'
pop dword ptr [_D+4]
pop dword ptr [_D]
.Lt_0002:
push 0
call _fb_End@4
mov esp, ebp
pop ebp
ret
#global initialized constants
.section .data
.balign 16
.balign 8
###stored as double
Lt_0003: .double 3.5
#global non-initialized vars
.section .bss
.balign 16
.balign 4
.lcomm _I,4
.balign 4
.lcomm _F,4
.balign 8
.balign 8
.lcomm _D,8
but if i make v=57 i get
.section .text
.balign 16
.globl _main
_main:
push ebp
mov ebp, esp
and esp, 0xFFFFFFF0
call ___main
push dword ptr [ebp+12]
push dword ptr [ebp+8]
call _fb_Init@8
call _fb_CallCTORS
.Lt_0001:
###move the integer value of 57 in to 'i'
mov dword ptr [_I], 57
###push the single value on to the stack
push dword ptr [Lt_0003]
###pop the single value off the stack and in to 'f'
pop dword ptr [_F]
###push the double value on to the stack
push dword ptr [Lt_0004]
push dword ptr [Lt_0004+4]
###pop the double value off the stack and in to 'd'
pop dword ptr [_D+4]
pop dword ptr [_D]
.Lt_0002:
push 0
call _fb_End@4
mov esp, ebp
pop ebp
ret
#global initialized constants
.section .data
.balign 16
.balign 4
###single float
Lt_0003: .float 57
.balign 8
###double float
Lt_0004: .double 57
#global non-initialized vars
.section .bss
.balign 16
.balign 4
.lcomm _I,4
.balign 4
.lcomm _F,4
.balign 8
.balign 8
.lcomm _D,8
Anyone got any explanation of the differences in behaviour there?