Thanks, is that the below, or something other?#NULL wrote: Sun Jul 31, 2022 2:00 pm Menu > Tools > Structure Viewer > Tab 'Structures' > scroll down list to 'String' and doubleclick to see Definition
https://imgur.com/a/GOhrA5D
Thanks, is that the below, or something other?#NULL wrote: Sun Jul 31, 2022 2:00 pm Menu > Tools > Structure Viewer > Tab 'Structures' > scroll down list to 'String' and doubleclick to see Definition
I think most of the variable types are only needed in structures, for instance for reading a specific file format, or when an API function requires particular data types. For normal variables, I personally almost exclusively use .i, .q., .d and $.Oso wrote: Sun Jul 31, 2022 11:37 am Yes, $ is convenient and it makes it clear throughout the code. But I was thinking more in terms of the range of variable types, not only strings. For example, the PB documentation lists a dozen Basic Types, some of which include the below.
Let's assume we've defined our variables at the top of our code. When someone else happens to be maintaining the main body of our code, it isn't always going to be clear what the types are, just from looking at variable names alone. It's necessary to keep referring back to the definitions, in other words.Code: Select all
.b byte .c character .u unicode .l long .i integer .d double
Therefore, would it be reasonable to append all variables with their type, throughout the code? Or would that be regarded as unnecessary 'bloat' by many PB developers? It's often better to follow the developer community norms.
Code: Select all
Global g_GlobalVar$
Define s_SharedVar.i
Code: Select all
Define$
Code: Select all
Define.s
Thanks for posting this, I'm beginning to get the impression with PB that there are one or two hidden concepts that aren't always documented. I think it emphasises the importance of sharing ideas on this great forum here!chikega wrote: Sun Jul 31, 2022 5:43 pm Not that this will make a big difference in ones code, but it's something I found by accident while playing with PB string types. It is not documented, but:appears to function the same asCode: Select all
Define$
Code: Select all
Define.s
Code: Select all
Structure main
a.i
b.i
c.i
name.s
EndStructure
Procedure displayC(*this.main)
With *this
Debug Str(\c)
EndWith
EndProcedure
Procedure main()
With *this
Define *this.main = AllocateMemory(SizeOf(main) )
\name = "Friday "
\a = 5
\b = 3
\c = \a + \b
displayC(*this)
EndWith
EndProcedure
main()