Prototype order of declaration matters (and it shouldn't)

Post bugreports for the Windows version here
Joubarbe
Enthusiast
Enthusiast
Posts: 710
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Prototype order of declaration matters (and it shouldn't)

Post by Joubarbe »

Even though PB is a single pass compiler, we can assign any type to a pointer, including one that is not yet declared. However, it doesn't work for prototypes.

Code: Select all

Structure _Struc
  *callback.__Callback
  *b._StrucB
EndStructure

Structure _StrucB
EndStructure

Prototype __Callback(value)

Define a._Struc

a\callback(4)
This code returns an error "garbage at the end of the line". This is wrong, it should return a memory address error instead. If you move the prototype declaration line at the top, then you have the mem address error.

This is just confusing and not coherent with declarations of pointers of unknown type.

I don't know what would be the best. 1/ Not allow pointer assignment to a prototype that is not yet declared 2/ Do like pointers assigned to not yet declared structures, like *b._StrucB in this example, and just allow whatever. I guess I would tend towards option 2, for cohesion.