Request: CTYPE and CARRAY

BlitzMax Forums/BlitzMax Programming/Request: CTYPE and CARRAY

Dreamora - this is so much more of a compiler implementation than an language issue. You have totally missed the point. C has nothing to do with it and I am not a C or C++ advocate at all. We are using C as an example, since many people know it.
ALL the examples will work in Delphi, VB, VB.Net, C#, C++, C, Pascal and many others. I've written software in all of them.

...and there appears to be a bug in the sizeof operator.
Which leads me to another point. sizeof happens to come from c / c++ (and many other langs). It's primary use in bmax is to identify the size of the type in memory so you can do binary streaming, and manipulate the object in many other low level ways. More C/C++ similarities include the :+, :-, etc (albeit C/C++ is +=, -=), the extern keyword. Whether you like it or not, bmax has many similarity to C.

My large example above (using colourargb, vert3 and cube types) has print sizeof(colorargb), etc.. They are incorrect. You can cut and paste the code upto the prints to see.

Anyhoo, it is entirely an implementation detail. Most programming languages since the beginning of time have always had some sort of complex data type that maps back to it's layout in memory.
A Delphi example for you to get off of C:
Type
  HighScoreRecord = Record
    Place : long;
    Scord : long;
    Initials: Array[0..2] of Char;
  End;

VB.Net:
Structure HighScoreRecord 
  Place As Integer
  Score As Integer
  Initials as System.Char[3]
End Structure 

VB 6.0:
Type HighScoreRecord 
  Place As Long
  Score As Long
  Initials As Char[3]
End Type

C++
class HighScoreRecord
{
public:
  long place;
  long score;
  char initials[3];
}

etc..

I don't care about C, Delphi or C++. I care about bmax in this instance.

I am at a loss as to why you are trying to make your life more difficult. We already have a structured type - no change here. All we are asking is that it is an exact representation in memory (or some way to 'flag' that it is). Nothing more.