Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 10:58 30 Mar 2026 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PicoMite BASIC Structure UNION?

Author Message
Mark
Regular Member

Joined: 26/11/2022
Location: United States
Posts: 97
Posted: 08:00pm 29 Mar 2026
Copy link to clipboard 
Print this post

Is it possible to have two (or more) variables with different STRUCT definitions refer to the same area in memory?

I'd like to use one layout for disk storage and another for in memory processing. The issue is that they are not the same size. I need to have a few extra bytes at the end for temporary processing that are not needed on disk.  I know I could just save the extra bytes to disk as there is plenty of room on the SD card, but I thought I'd ask.

Thanks,
Mark
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11113
Posted: 08:19pm 29 Mar 2026
Copy link to clipboard 
Print this post

No: If you want to program in C then it is avilable but this is Basic and structures are already way beyond what is normally available
 
bfwolf
Senior Member

Joined: 03/01/2025
Location: Germany
Posts: 195
Posted: 09:48pm 29 Mar 2026
Copy link to clipboard 
Print this post

If I understand your problem correctly, the following might be a solution for your use case:

A "container struct" in RAM that has the on-file struct as a member, followed by the members you need for management in RAM.
 
Mark
Regular Member

Joined: 26/11/2022
Location: United States
Posts: 97
Posted: 11:55pm 29 Mar 2026
Copy link to clipboard 
Print this post

matherp,

That makes sense. I am so used to STRUCT's in other languages, I take them for granted, not realizing how limited BASIC was.

bfwolf,

I thought about that, but it appears that STRUCT SAVE only works with entire STRUCT, not fields.

Mark
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026