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: 666
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.02 x64, OS: Win 7 Pro x64 & Win 11 x64, Desktopscaling: 125%, CPU: I7 6500, RAM: 16 GB, GPU: Intel Graphics HD 520, User age in 2024: 56y
"Happiness is a pet." | "Never run a changing system!"