Compilertime: Test of strings of fixed length in structures

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Kurzer
Enthusiast
Enthusiast
Posts: 693
Joined: Sun Jun 11, 2006 12:07 am
Location: Near Hamburg

Compilertime: Test of strings of fixed length in structures

Post by Kurzer »

I'm just noticing that I can assign more data to a string of fixed length that is in a structure than it's length is defined.

No Problem to run this code fragments.

Code: Select all

Structure Settings
   ; other values
   sCompression.s{1}
EndStructure

Code: Select all

SettingVariable\sCompression = "123456"
Okay, the data will be truncated and only as much will be stored in the string as it can hold, but can the compiler give a warning in this case? So far he doesn't do this yet.
I didn't realized this at first, because the situation was caused by a wrong search/replace task.

Regards Kurzer
PB 6.12 x64, OS: Win 11 24H2 x64, Desktopscaling: 150%, CPU: I7 12700 H, RAM: 32 GB, GPU: Intel(R) Iris(R) Xe Graphics | NVIDIA GeForce RTX 3070, User age in 2025: 57y
"Happiness is a pet." | "Never run a changing system!"