Hello,
Why does a structure have to be defined on a single line? This is an issue when it comes to structures with large amount of fields.
DIM structure
-
- Posts: 366
- Joined: Tue 18 Jun 2024, 09:32
Re: DIM structure
It doesn't! Here's an example of a multi-line structure declaration, taken from the BBC BASIC for Windows manual:kirkkaf13@gmail.com wrote: ↑Thu 03 Apr 2025, 15:18 Why does a structure have to be defined on a single line?
Code: Select all
DIM osvi{Size%, \ Size of structure
\ Major%, \ Major version number
\ Minor%, \ Minor Version number
\ Build%, \ Build number
\ Platform%, \ Platform ID
\ SP&(127) \ Service Pack string
\ }
-
- Posts: 9
- Joined: Fri 23 Aug 2024, 21:37
Re: DIM structure
Thank you for pointing me in the right direction.
I would say it's not very clear from the manual since all the examples in the obvious places such as DIM and Structures only show single line examples and don't introduce this \ line continuation character.
I would say it's not very clear from the manual since all the examples in the obvious places such as DIM and Structures only show single line examples and don't introduce this \ line continuation character.
-
- Posts: 366
- Joined: Tue 18 Jun 2024, 09:32
Re: DIM structure
The line-continuation character is documented here, where it states that it may be used "almost anywhere that a space would be allowed". I don't think it would be feasible or desirable to try to modify the many places in the rest of the manual where a line-continuation character could be used so that one is in fact used.kirkkaf13@gmail.com wrote: ↑Thu 03 Apr 2025, 16:52 I would say it's not very clear from the manual since all the examples in the obvious places such as DIM and Structures only show single line examples
Would you argue that the DIM statement is a special case, and is more deserving of having multi-line examples included in the documentation than other statements? To see what other BASICs do I've looked at the Liberty BASIC manual and the documentation of the DIM statement there does not include any examples of it being split into multiple lines, even though it can be.
And if it is your view that DIM is special, what about other examples of lists which can sometimes be usefully split into multiple lines, such as initialising arrays? Can you suggest specific places in the manual where you think multi-line examples should be added?