Bill Currie wrote:
Peter Gerwinski wrote:
According to Bill Currie:
function DecToBin( DecInput : string ) : wrkstring; [...] trunkuti.pas: In function `Dectobin': trunkuti.pas:332: prior parameter's size depends on `Decinput' make.exe: *** [trunkuti.o] Error 1
I'll keep trying to reproduce the error in a smaller file.
Right, Success!! I've managed to reproduce the error in a smaller file. If I comment out the parameters (or the body of the function) in the implementation section, the error disapears. In the real file, the ReadStr causes an abort when the implementation paramteters are commented out (interface decl same as always). I have not yet been able to reproduce the abort. The command line used is: gpc -O2 -c -o foo.o foo.pas Bill -- Leave others their otherness. unit foo; interface uses System; function DecToBin( DecInput : string ) : wrkstring; implementation function DecToBin( DecInput : string ) : wrkstring; { converts a decimal string[ up to 256 ] into binary string } var TempStr : wrkstring; DecNum, Mask : word; Pos : byte; Err : integer; begin TempStr := ''; mask := $8000; ReadStr(DecInput,DecNum,Err); for Pos := 1 to 16 do begin if (mask and DecNum) > 0 then TempStr := TempStr + '1' else TempStr := TempStr + '0'; mask := mask div 2; end; while (TempStr[1] = '0') and (length(TempStr) > 1) do { returns at least 0} delete(TempStr,1,1); DecToBin := TempStr; end; end.