Edja wrote: ↑Sat 15 Aug 2020, 12:05
Why would I ever redimension a structure if this doesn' t change anything ?
The most likely reason is a PRIVATE structure. Consider this procedure:
Code: Select all
DEF PROCtest
PRIVATE struct{}
DIM struct{member1, member2}
struct.member1 += 1
PRINT struct.member1
ENDPROC
Since the structure is declared as PRIVATE its contents must remain unchanged from one call of the procedure to the next, that's the definition of PRIVATE. But necessarily the structure is declared within the procedure, since that defines its scope, so if the declaration were to initialise the contents of the structure the PRIVATE would be ineffective. You would end up with it behaving like a LOCAL structure instead.
There are other situations in which applying the principles of
Information Hiding or
Encapsulation you might find it desirable to declare even a global structure multiple times rather than just once, to hide its declaration from view. The
dlglib library does that a lot, I think.