www.digitalmars.com         C & C++   DMDScript  

D - array declaration with type of subscript.

reply dm tmca.ac.jp writes:
int [300] a;  // declares a as an array of integer of size 300.

How about to make declare the type of the subscript expression for an array ?


int [300] a;
int [int 300] a1;
int [long 300] a2;
int [char 300] a3;
int [uint 300] a4;
int [long 300] a4;
int [ulong 300] a5; 

int [] x;
int [int] x1;
int [long] x2;
int [char] x3;
int [uint] x4;
int [long] x5;
int [ulong] x6;

etc. the specification of the type of the array bound 
indicates what kind of the array subscript expression is expected.

Hiroshi Murakami
Jun 12 2004
parent J Anderson <REMOVEanderson badmama.com.au> writes:
dm tmca.ac.jp wrote:

int [300] a;  // declares a as an array of integer of size 300.

How about to make declare the type of the subscript expression for an array ?


int [300] a;
int [int 300] a1;
int [long 300] a2;
int [char 300] a3;
int [uint 300] a4;
int [long 300] a4;
int [ulong 300] a5; 

int [] x;
int [int] x1;
int [long] x2;
int [char] x3;
int [uint] x4;
int [long] x5;
int [ulong] x6;

etc. the specification of the type of the array bound 
indicates what kind of the array subscript expression is expected.

Hiroshi Murakami
  
Or even better allow ranges like ada did: //Stab at D form range G = 1..100; int [G] a; range X = 1..100 extends uint; int [G] b; PS - For Your Information... This is the *old* newsgroup. Please post *new* threads in either the new General newsgroup or the Bug newsgroup. *GENERAL D Discussions* Web: http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D Newsgroup: news://news.digitalmars.com/digitalmars.D *BUG REPORTS for DMD* Web: http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs Newsgroup: news://news.digitalmars.com/digitalmars.D.bugs *D GNU newsgroup* Web: http://www.digitalmars.com/drn-bin/wwwnews?D.gnu Newsgroup: news://news.digitalmars.com/D.gnu *Old D newsgroup* (don't post here anymore!) Web: http://www.digitalmars.com/drn-bin/wwwnews?D Newsgroup: news://news.digitalmars.com/D Unofficial forums... *dsource.org* Forums (phpBB) http://www.dsource.org/forums/ It's also good courtesy to examine the Frequently Asked Questions before posting: http://www.digitalmars.com/d/faq.html http://www.wikiservice.at/d/wiki.cgi?FaqRoadmap Thank you for your help. -- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/ -- -Anderson: http://badmama.com.au/~anderson/
Jun 12 2004