[Compiler-v531]Add warning for Proc(*ptr.struct) not passed.

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

[Compiler-v531]Add warning for Proc(*ptr.struct) not passed.

Post by skywalk »

Hard to find bug in a dll that did not flag a procedure parameter as incorrect data type.
I realize pointers can be anything, but if the Procedure is explicit, the compiler should at least give a warning.

Code: Select all

ProcedureDLL Do1(*p.ABC)
  Debug *p\abcA
  Debug *p\abcB
  Debug *p\abcC
EndProcedure
Define.i x
Define *p.ABC = AllocateMemory(SizeOf(ABC))
*p\abcA = 1: *p\abcB = 2: *p\abcC = 3: 
do1(@x)  ;<-- Please add a warning here --> Expecting a Structure(ABC) or pointer to Structure(ABC).
do1(*p)
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum