type data elements individually

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

type data elements individually

Post by Tenaja »

I'd like to wish for the ability to mix strings and numbers in Data. Since strings are turned into pointers, would this not be possible?

Code: Select all

Data.i 5, "text1"
Data.i 432, "text2"
Alternatively, (and maybe even preferably) can we type each data element individually?

Code: Select all

Data 432.i, "text2", 5.b    ; strings are "auto-typed"
Data 976.i, "MoreText", 8.b
The reason for the request:
At this time, a loop is required to initialize an array (which is a hack to those who have worked with languages with array initialization), and it also requires separate data lines for every data type. Those two limitations severely diminish readability as well as ease of maintenance. This requested feature would allow a more compact (easier-to-read) method to initialize array sets and/or structures.

Thanks.
User avatar
Demivec
Addict
Addict
Posts: 4261
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: type data elements individually

Post by Demivec »

Tenaja wrote:I'd like to wish for the ability to mix strings and numbers in Data. Since strings are turned into pointers, would this not be possible?
Just to update your information, the strings stored in a DataSection are literals, not pointers.


It would be nice if something could be done for the situation described. Here is another feature request for a slightly different way of dealing with it (in the syntax).
Post Reply