I agree this should throw an error during compilation (consistency).
However, it doesn't have side effects, since pointers are always the same size
and it is also required for forward declarations (i.e. you can use structures for pointers before they are actually defined).
Yeah, but the compiler could check at the end if the structure has actually been defined.
As I said, it doesn't have any side effects. If you have a typo you will notice that when you try to access the fields.
By the way, C++ compilers (at least the one I tested) don't do the check either, but I'd imagine it's because of late linking
of classes (which isn't really possible with PB). So I'd vote for adding a check.
Shield wrote:Yeah, but the compiler could check at the end if the structure has actually been defined.
Wouldn't that require the compiler making two passes instead of one?
No. While the compiler goes through it knows what structures have been defined and what structures have been used.
If a structure has been used which hasn't been defined an error should be thrown.
Shield wrote:
No. While the compiler goes through it knows what structures have been defined and what structures have been used.
If a structure has been used which hasn't been defined an error should be thrown.
That's why should be very easy to add a report for ALL the variables defined but never used.
It would be useful to remove unwanted zombies (in time working on the same code it happens).
That's why should be very easy to add a report for ALL the variables defined but never used.
It would be useful to remove unwanted zombies (in time working on the same code it happens).
I still thing there is a clever way to solve this inconvenience (inconsistence indeed) with the one-pass compiling scheme. (Even in the C++ seems also not solved)
For future ??