compile time type checking
Posted: Thu Nov 15, 2012 9:45 am
Hi,
I red about the feature from harbour to check the type of a variable at compile time.
So I tried it, but I do not get any warnings at compile time.
Here is the code of t.prg :
this ist the screen from compiler (I did delete the *.OBJ and *.EXE before):
hbmk2 t /W3 <= this line should report the num + string type error at compiletime or ?
I red about the feature from harbour to check the type of a variable at compile time.
So I tried it, but I do not get any warnings at compile time.
Here is the code of t.prg :
Code: Select all
function main()
local sTxt := "Hallo äöü ß @ € "
local nZahl := 5
cls
?
? sTxt,nZahl
? MyFunc()
? "Ergebnis: ", sTxt * nZahl
wait
return 0
function MyFunc()
local sTxt as CHARACTER
local nZahl as numeric
sTxt := "Hallo äöü ß @ € "
nZahl := 5
return sTxt + nZahl
Code: Select all
C:\TEMP\test>hbmk2 t /W3
Harbour 3.2.0dev (Rev. 17516)
Copyright (c) 1999-2012, http://harbour-project.org/
Compiling 't.prg'...
Lines 21, Functions/Procedures 2
Generating C source output to 'c:\temp\hbmk_6silnj.dir\t.c'... Done.
c:\temp\hbmk_6silnj.dir\t.c:
Turbo Incremental Link 5.69 Copyright (c) 1997-2005 Borland
C:\TEMP\test>