Page 1 of 1

compile time type checking

Posted: Thu Nov 15, 2012 9:45 am
by BrandelH
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 :

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
this ist the screen from compiler (I did delete the *.OBJ and *.EXE before):

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>
hbmk2 t /W3 <= this line should report the num + string type error at compiletime or ?

Re: compile time type checking

Posted: Thu Nov 15, 2012 11:34 am
by Antonio Linares
Hubert,

I have tested your example and I get your same results.

Better comment it at the Harbour developers list:
https://groups.google.com/forum/?fromgr ... bour-devel

thanks,

Re: compile time type checking

Posted: Mon Nov 19, 2012 4:09 pm
by BrandelH
Thanks for the LINK, I posted there 4 days ago, 15 reads, no answer.
It looks like they are busy at the moment ;-)