1 Oct 03:29
Re: main function signature?
Slawomir Lisznianski <slisznianski <at> c2-lang.org>
2004-10-01 01:29:19 GMT
2004-10-01 01:29:19 GMT
Rajesh Walkay wrote: > If pointers are second class citizens in C2, what would be the main > function signature?(Continue reading)It depends on what type is str of in the following expression: T str = "What am I"; Knowing the answer to the above will help us determine the signature of the main function. In C++, T is of type: const char* <- pointer to const characters In C2, T might be of type: []<char const> local^ <- reference to local array of const characters Since argv in C++ is a pointer to pointers to const chars, C2 argv would be declared as a reference to array of references to arrays of const characters. Our main function would then have a signature: int Main(int, []<[]<char const> any^> any^); I can just imagine your disappointment-- it surely looks easy to make a mistake. The easiest way to make it shorter would be to declare a typedef in some standard header:
It depends on what type is str of in the following expression:
T str = "What am I";
Knowing the answer to the above will help us determine the signature of
the main function.
In C++, T is of type:
const char* <- pointer to const characters
In C2, T might be of type:
[]<char const> local^ <- reference to local array of
const characters
Since argv in C++ is a pointer to pointers to const chars, C2 argv would
be declared as a reference to array of references to arrays of const
characters. Our main function would then have a signature:
int Main(int, []<[]<char const> any^> any^);
I can just imagine your disappointment-- it surely looks easy to make a
mistake.
The easiest way to make it shorter would be to declare a typedef in some
standard header:
RSS Feed